예제 #1
0
    /// <summary>
    /// Method in charge of setting the state of a character after it has been killed or freed.
    /// It also calls GUIController.AssignCharacter to show the character in the top right corner.
    /// When the number of deadCharacters plus the number of aliveCharacters is equal to the number of total characters,
    /// the game is over.
    /// <seealso cref="GUIController.AssignCharacter"/>
    /// </summary>
    /// <param name="character">Character to set.</param>
    /// <param name="alive">Indicates if the character has been freed or killed.</param>
    public void SettleCharacter(MovableEntity character, bool alive)
    {
        if (alive)
        {
            _savedCharacters++;
        }
        else
        {
            _deadCharacters++;
        }
        character.SetActive(false);
        guiController.AssignCharacter(character, alive);

        if (_savedCharacters + _deadCharacters == _spawnManager.TotalCharacters)
        {
            CheckGameOver();
        }
    }