diff --git a/Assets/AWSIM/Scripts/Loader/EgosManager.cs b/Assets/AWSIM/Scripts/Loader/EgosManager.cs index 744f40fef..cc0cf39a7 100644 --- a/Assets/AWSIM/Scripts/Loader/EgosManager.cs +++ b/Assets/AWSIM/Scripts/Loader/EgosManager.cs @@ -79,6 +79,17 @@ public void LoadUI() egoUISelecor.RefreshShownValue(); } + // Sin cont. + public void UpdateMapDefaultSpawn(double mapPosX, double mapPosY, double mapPosZ, double mapRotX, double mapRotY, double mapRotZ) + { + positionInputFields[0].text = mapPosX.ToString(); + positionInputFields[1].text = mapPosY.ToString(); + positionInputFields[2].text = mapPosZ.ToString(); + rotationInputFields[0].text = mapRotX.ToString(); + rotationInputFields[1].text = mapRotY.ToString(); + rotationInputFields[2].text = mapRotZ.ToString(); + } + /// /// Gets the position from the GUI input fields. /// diff --git a/Assets/AWSIM/Scripts/Loader/MapManager.cs b/Assets/AWSIM/Scripts/Loader/MapManager.cs index 418289a73..85d007781 100644 --- a/Assets/AWSIM/Scripts/Loader/MapManager.cs +++ b/Assets/AWSIM/Scripts/Loader/MapManager.cs @@ -38,12 +38,15 @@ public class MapManager : MonoBehaviour, IConfigurableManager /// public Action Log { get; set; } + private EgosManager _egosManager; + public void Start() { if (!forbiddenSceneNames.Contains(SceneManager.GetActiveScene().name)) { forbiddenSceneNames.Add(SceneManager.GetActiveScene().name); } + _egosManager = GameObject.FindObjectOfType(); } /// @@ -85,6 +88,7 @@ public void LoadUI() } mapUISelecor.value = 0; mapUISelecor.RefreshShownValue(); + mapUISelecor.onValueChanged.AddListener(delegate { UpdateFields(mapUISelecor.options[mapUISelecor.value]); }); } /// @@ -109,9 +113,39 @@ public bool LoadConfig(AWSIMConfiguration config) return false; } } - return true; } - } + // Sin (other part is in EgosManager.cs) + private void UpdateFields(Dropdown.OptionData data) + { + double mapPosX = 0; + double mapPosY = 0; + double mapPosZ = 0; + double mapRotX = 0; + double mapRotY = 0; + double mapRotZ = 0; + + switch (data.text) + { + case "Shinjuku" or "ShinjukuNight": + mapPosX = 81380.72; + mapPosY = 49918.78; + mapPosZ = 41.57; + mapRotX = 0; + mapRotY = 0; + mapRotZ = 35; + break; + case "Parking Area": + mapPosX = 81580.52; + mapPosY = 50083.58; + mapPosZ = 41; + mapRotX = 0; + mapRotY = 0; + mapRotZ = 100; + break; + } + _egosManager.UpdateMapDefaultSpawn(mapPosX, mapPosY, mapPosZ, mapRotX, mapRotY, mapRotZ); + } + } }