private void SetText() { if (player != null) { // Get currently carried number of masks from the player m_TextComponent.text = player.getNumMasks().ToString(); } else { // Could not find player, set text to 0 m_TextComponent.text = "0"; } }
protected override void Update() { // Check if we collected all masks and returned them to the hospital. // If so, pause the game and show a screen telling us to get home. if (!LevelSettings.GetActiveEndLevelController().levelHasFinished&& ShowCanvasAllCollectedGetHome()) { // The player has collected all masks and brought them to the hospital. // Get a reference to the player. Components.Player player = GameObject.FindWithTag("Player").GetComponent <Components.Player>(); // Set the number of masks of the player to 0, // since he gave his masks to the hospital. player.addMasks(-player.getNumMasks()); // Pause the game PauseGame.Pause(); // Show the pause message that tells him to get home. // This canvas has a "space-to-continue"-script attached CanvasAllCollectedGetHome.SetActive(true); // Set internal bool that the player is now on its way home onWayHome = true; } base.Update(); }