//Initializes the game for each level. void InitGame() { //While doingSetup is true the player can't move, prevent player from moving while title card is up. doingSetup = true; startRoom = GameObject.FindGameObjectWithTag("StartRoom"); roomLayout = startRoom.GetComponent <RoomLayout>(); roomLayout.SendMessage("SetupScene", level); Debug.Log("Sent Message to SetupScene. Level = " + level); //Get a reference to our image LevelImage by finding it by name. levelImage = GameObject.Find("LevelImage"); //Get a reference to our text LevelText's text component by finding it by name and calling GetComponent. levelText = GameObject.Find("LevelText").GetComponent <Text>(); //Set the text of levelText to the string "Day" and append the current level number. levelText.text = "Day " + level; //Set levelImage to active blocking player's view of the game board during setup. levelImage.SetActive(true); //Call the HideLevelImage function with a delay in seconds of levelStartDelay. Invoke("HideLevelImage", levelStartDelay); //Clear any Enemy objects in our List to prepare for next level. enemies.Clear(); }