public void ClearToChange() { SentCubes.Clear(); if (CurrentConstruct != null) { CurrentConstruct.Reset(); } for (int i = 0; i < CubesLoc.Count; i++) { CubesLoc[i].SetActive(true); } for (int i = 0; i < CubesLoc.Count; i++) { if (i < ConstructsObtained[ConstructIndex].RequiredCubes) { SentCubes.Add(CubesLoc[i]); } else { CubesLoc[i].SetActive(false); CubesLoc[i].transform.position = transform.position; } } CurrentConstruct = ConstructsObtained[ConstructIndex]; CurrentConstruct.SetUp(transform, PlayerNum); CurrentConstruct.ChangeInto(SentCubes); }
public void Awake() { for (int i = 0; i < transform.childCount; i++) { CubesLoc.Add(transform.GetChild(i).gameObject); } if (ConstructDirectory.IsLoaded == false) { ConstructDirectory.Load(); } ConstructDisplayed = new ConstructData(); ConstructDisplayed = ConstructDirectory.GetRandom(); List <GameObject> SentCubes = new List <GameObject>(); for (int i = 0; i < CubesLoc.Count; i++) { if (i < ConstructDisplayed.RequiredCubes) { CubesLoc[i].SetActive(true); SentCubes.Add(CubesLoc[i]); } else { CubesLoc[i].transform.position = transform.position; CubesLoc[i].SetActive(false); } } ConstructDisplayed.SetUp(this.transform, 0); ConstructDisplayed.ChangeInto(SentCubes); }
void Awake() { rb = GetComponent <Rigidbody>(); if (PlayerList == null) { PlayerList = new List <CubePlayer>(); Players = new string[4]; } AssignPlayer(); DontDestroyOnLoad(this.gameObject); for (int i = 0; i < transform.childCount; i++) { if (gameObject.transform.GetChild(i).gameObject.tag == "Cube") { CubesLoc.Add(gameObject.transform.GetChild(i).gameObject); } } if (ConstructDirectory.IsLoaded == false) { ConstructDirectory.Load(); } ConstructsObtained = new ConstructData[4]; ConstructsObtained[0] = (ConstructDirectory.Find(ConstructType.CubeGuy)); ConstructsObtained[1] = (ConstructDirectory.Find(ConstructType.Turret)); ConstructsObtained[2] = (ConstructDirectory.Find(ConstructType.Car)); ConstructsObtained[3] = (ConstructDirectory.Find(ConstructType.Tank)); SentCubes = new List <GameObject>(); Menu = new MenuControl(MenuObj, this); for (int i = 0; i < CubesLoc.Count; i++) { if (i < ConstructsObtained[0].RequiredCubes) { SentCubes.Add(CubesLoc[i]); } else { CubesLoc[i].transform.position = transform.position; CubesLoc[i].SetActive(false); } } CurrentConstruct = ConstructsObtained[0]; CurrentConstruct.SetUp(this.transform, PlayerNum); CurrentConstruct.ChangeInto(SentCubes); }