public void mainchange(int i) { GameObject[] del = GameObject.FindGameObjectsWithTag("chooser"); RandomRoadChooser.spdup = false; foreach (GameObject ro in del) { if (ro.name.StartsWith("tramp")) { ro.transform.localScale = new Vector3(28f, 28f, 28f); } ro.SetActive(false); ro.tag = "Untagged"; } SoundManager.instance.playSingle(); if (gameObject.transform.GetChild(0).gameObject.activeSelf == false) { name_road(i); print("we here" + RandomRoadChooser.choose[i].ToString()); GameObject go = PhotonNetwork.Instantiate( Path.Combine("PhotonPrefabs", RandomRoadChooser.choose[i].roadName.ToString()), next_road_position.position + vector3, rotator); GameObject go2 = ObjectPoolingManager.Instance.GetObject(RandomRoadChooser.choose[i].roadName.ToString()); if (go2.gameObject.transform.GetChild(1).gameObject.active) { go.GetPhotonView().RPC("setPowerUp", RpcTarget.All); } roadss.Add(go); roadss2.Add(go2); timers.Add(timeToLive); n++; go.tag = n.ToString(); go.transform.position = next_road_position.position + vector3; go2.GetComponent <Renderer>().materials = go.GetComponent <Renderer>().materials; go2.transform.position = next_road_position.position + vector3; go.transform.rotation = rotator; go2.transform.rotation = rotator; next_road_position.position = go.gameObject.transform.GetChild(3).position; if (pun) { CleanRoad(roadcheck, nroaddelete); } go.SetActive(false); //DeleteRoad.CleanRoad(); RoadRotator.rotator(); flag = false; print(n); if (changeRoadEvent != null) { changeRoadEvent(); } } }
public void mainchange(int i) { GameObject[] del = GameObject.FindGameObjectsWithTag("chooser"); RandomRoadChooser.spdup = false; foreach (GameObject ro in del) { ro.SetActive(false); ro.tag = "Untagged"; } SoundManager.instance.playSingle(); if (gameObject.transform.GetChild(0).gameObject.activeSelf == false) { print("hereee"); name_road(i); print("we here" + RandomRoadChooser.choose[i].roadName.ToString()); GameObject go = ObjectPoolingManager.Instance.GetObject(RandomRoadChooser.choose[i].roadName.ToString()); print(go.gameObject.name); roadss.Add(go); //n++; //go.tag = n.ToString(); go.transform.position = next_road_position.position + vector3; go.transform.rotation = rotator; print(go.gameObject.transform.GetChild(3)); next_road_position.position = go.gameObject.transform.GetChild(3).position; //DeleteRoad.CleanRoad_god(); //DeleteRoad.CleanRoad(); CleanRoad(4, 1); RoadRotator.rotator(); currentTime = startingTime; //myroute.UpdateNodes(); if (acceleration <= 2.5f) { acceleration = acceleration * 1.1f; } flag = false; StartCoroutine(nextDelay()); print(n); if (changeRoadEvent != null) { changeRoadEvent(); } } }