IEnumerator Restart() { gameIsOn = false; //Clear all the tiles if (holderGrid != null) { Destroy(holderGrid); } holderGrid = new GameObject("Grid Holder"); holderGrid.transform.SetParent(transform); //Generate the grid grid = new GameObject[(int)size.x, (int)size.y]; GUI1.SetActive(false); GUI2.SetActive(false); GUI3.SetActive(false); GUIPANEL.SetActive(false); GUIBUTTON.SetActive(false); tuto.SetActive(true); GUITUTO.SetActive(true); while (tuto.GetComponent <TutorialManager>().linhaTexto < 3) { yield return(null); } GUI2.SetActive(true); while (tuto.GetComponent <TutorialManager>().linhaTexto < 5) { yield return(null); } GUIPANEL.SetActive(true); while (tuto.GetComponent <TutorialManager>().linhaTexto < 6) { yield return(null); } GenerateGrid(); while (tuto.GetComponent <TutorialManager>().linhaTexto < 7) { yield return(null); } SpawnInitialColony(); if (tuto.GetComponent <TutorialManager>().linhaTexto < 21) { GUITUTO.SetActive(false); yield return(new WaitForSeconds(4)); GUITUTO.SetActive(true); } while (tuto.GetComponent <TutorialManager>().linhaTexto < 10) { yield return(null); } GUIBUTTON.GetComponent <Button>().interactable = false; GUIBUTTON.SetActive(true); while (tuto.GetComponent <TutorialManager>().linhaTexto < 21) { yield return(null); } SetPlayer(); StartCoroutine(GameLoop()); GUI1.SetActive(true); GUI2.SetActive(true); GUI3.SetActive(true); GUIPANEL.SetActive(true); GUIBUTTON.SetActive(true); GUITUTO.SetActive(false); tuto.SetActive(false); GUIBUTTON.GetComponent <Button>().interactable = true; yield break; }
void TurnOffGUI() { GUI1.SetActive(false); GUI2.SetActive(false); GUI3.SetActive(false); }