void Start() { aboutMenuObj.SetActive(false); descriptionMenuObj.SetActive(false); StartCoroutine(UpdateSpeedText()); ifFoundPathText.text = ""; //Init the dropdowns //Search tree List <string> searchTreeOptionsStrings = new List <string>(); int numOfEnums1 = Enum.GetNames(typeof(DisplayController.SearchTreeTypes)).Length; for (int i = 0; i < numOfEnums1; i++) { DisplayController.SearchTreeTypes word = (DisplayController.SearchTreeTypes)i; searchTreeOptionsStrings.Add(word.ToString()); } dropdownSearchTree.AddOptions(searchTreeOptionsStrings); //Texture List <string> textureOptionsStrings = new List <string>(); int numOfEnums2 = Enum.GetNames(typeof(DisplayController.TextureTypes)).Length; for (int i = 0; i < numOfEnums2; i++) { DisplayController.TextureTypes word = (DisplayController.TextureTypes)i; textureOptionsStrings.Add(word.ToString()); } dropdownDisplayTexture.AddOptions(textureOptionsStrings); //Vehicles List <string> vehicleStrings = new List <string>(); int numOfEnums3 = Enum.GetNames(typeof(SimController.VehicleTypes)).Length; for (int i = 0; i < numOfEnums3; i++) { SimController.VehicleTypes word = (SimController.VehicleTypes)i; vehicleStrings.Add(word.ToString()); } dropdownChangeVehicle.AddOptions(vehicleStrings); }
//Change vehicle (will also reset if we select the current vehicle) public void ChangeVehicle(int index) { if (SimController.current == null) { return; } //Which vehicle did we select in the dropdown SimController.VehicleTypes type = (SimController.VehicleTypes)index; SimController.current.ChangeVehicle(type); //Now we need to select the first enum again which is none, because if we have selected the car //and try to select it again from the drop down, it will not work dropdownChangeVehicle.value = 0; }