,Hello, I am struggling with selecting cars from a specific list. For example, I have an ambulance, bus, police, garbage Truck, fire department and a taxi car lists to choose in the Car Selection Menu and There is a game manager script that calls settings about cars. I thought that I should make 6 different scenes but it would affect game performance. So can you help me? sorry about that English. Thank a lot. Tell me if you don't understand I will be more explanatory.
private void Awake () {
Instantiate (ambulanceList.vehicles[PlayerPrefs.GetInt ("pointer")], startPosition.transform.position, startPosition.transform.rotation);
RR = GameObject.FindGameObjectWithTag ("Player").GetComponent ();
presentGameObjectVehicles = GameObject.FindGameObjectsWithTag ("AI");
presentVehicles = new List ();
foreach (GameObject R in presentGameObjectVehicles)
presentVehicles.Add (new vehicle (R.GetComponent ().currentNode, R.GetComponent ().carName,R.GetComponent ().hasFinished));
presentVehicles.Add (new vehicle (RR.gameObject.GetComponent ().currentNode, RR.carName , RR.hasFinished));
temporaryArray = new GameObject[presentVehicles.Count];
temporaryList = new List ();
foreach (GameObject R in presentGameObjectVehicles)
temporaryList.Add (R);
temporaryList.Add (RR.gameObject);
fullArray = temporaryList.ToArray ();
//displayArray ();
StartCoroutine (timedLoop ());
}
↧