Пример #1
0
    public static PlayerCharacter GetCharacterLeft()
    {
        if (CharacterSelector.AreAllPlayersDead() == true)
        {
            Debug.LogError("GAME OVER!");
            return(null);
        }

        PlayerCharacter nextPlayer = null;

        if (CharacterSelector.currentCharacterIndex == 0)
        {
            CharacterSelector.currentCharacterIndex = CharacterSelector.characterNameList.Count - 1;
            nextPlayer = CharacterSelector.GetCharacterByType(CharacterSelector.characterNameList[CharacterSelector.characterNameList.Count - 1]);

            if (nextPlayer.isDead == true)
            {
                return(CharacterSelector.GetCharacterLeft());
            }

            return(nextPlayer);
        }

        nextPlayer = CharacterSelector.GetCharacterByType(CharacterSelector.characterNameList[--CharacterSelector.currentCharacterIndex]);

        if (nextPlayer.isDead == true)
        {
            return(CharacterSelector.GetCharacterLeft());
        }

        return(nextPlayer);
    }