PlayerBase FindWinningPlayer()
    {
        //to find out who won
        PlayerBase retVal = null;

        StateManager targetPlayer = null;

        //check to see if both players have equal health;
        if (charM.players[0].playerStates.health != charM.players[1].playerStates.health)
        {
            //no? who is lower? higher is winner
            if (charM.players[0].playerStates.health < charM.players[1].playerStates.health)
            {
                charM.players[1].score++;
                targetPlayer = charM.players[1].playerStates;
                levelUI.AddWinIndicator(1);
            }
            else
            {
                charM.players[0].score++;
                targetPlayer = charM.players[0].playerStates;
                levelUI.AddWinIndicator(0);
            }

            retVal = charM.returnPlayerFromStates(targetPlayer);
        }
        return(retVal);
    }
    PlayerBase FindWinningPlayer()
    {
        // para encontrar quien ganoo la ronda
        PlayerBase   retVal       = null;
        StateManager targetPlayer = null;

        // mira si los characters tienen la misma vida
        if (charM.players[0].playerStates.health != charM.players[1].playerStates.health)
        {
            // si no, busca el character con menor vida, entonces el otro character es el ganador
            if (charM.players[0].playerStates.health < charM.players[1].playerStates.health)
            {
                charM.players[1].score++;
                targetPlayer = charM.players[1].playerStates;
                levelUI.AddWinIndicator(1);
            }
            else
            {
                charM.players[0].score++;
                targetPlayer = charM.players[0].playerStates;
                levelUI.AddWinIndicator(0);
            }
            retVal = charM.returnPlayerFromStates(targetPlayer);
        }
        return(retVal);
    }
    PlayerBase FindWinningPlayer()
    {
        PlayerBase retVal = null;

        StateManager targetPlayer = null;

        if (Playerr.players[0].playerStates.health != Playerr.players[1].playerStates.health)
        {
            if (Playerr.players[0].playerStates.health < Playerr.players[1].playerStates.health)
            {
                Playerr.players[1].score++;
                targetPlayer = Playerr.players[1].playerStates;
                levelUI.AddWinIndicator(1);
            }
            else
            {
                Playerr.players[0].score++;
                targetPlayer = Playerr.players[0].playerStates;
                levelUI.AddWinIndicator(0);
            }

            retVal = Playerr.returnPlayerFromStates(targetPlayer);
        }

        return(retVal);
    }
Exemplo n.º 4
0
    PlayerBase FindWinningPlayer()
    {
        //to find who won the turn
        PlayerBase retVal = null;

        StateManager targetPlayer = null;

        //check first to see if both players have equal health
        if (charM.players[0].playerStates.health != charM.players[1].playerStates.health)
        {
            //if not, then check who has the lower health, the other one is the winner
            if (charM.players[0].playerStates.health < charM.players[1].playerStates.health)
            {
                charM.players[1].score++;
                targetPlayer = charM.players[1].playerStates;
                levelUI.AddWinIndicator(1);
            }
            else
            {
                charM.players[0].score++;
                targetPlayer = charM.players[0].playerStates;
                levelUI.AddWinIndicator(0);
            }

            retVal = charM.returnPlayerFromStates(targetPlayer);
        }

        return(retVal);
    }
Exemplo n.º 5
0
    PlayerBase FindWinningPlayer()
    {
        //чтобы найти победителя
        PlayerBase retVal = null;

        StateManager targetPlayer = null;

        //проверяем равенство здоровья персонажей
        if (charM.players[0].playerStates.health != charM.players[1].playerStates.health)
        {
            // если не соблюдается равенство, то проверяем, у кого здоровье меньше, другой игрок будет являться победителем
            if (charM.players[0].playerStates.health < charM.players[1].playerStates.health)
            {
                charM.players[1].score++;
                targetPlayer = charM.players[1].playerStates;
                levelUI.AddWinIndicator(1);
            }
            else
            {
                charM.players[0].score++;
                targetPlayer = charM.players[0].playerStates;
                levelUI.AddWinIndicator(0);
            }

            retVal = charM.returnPlayerFromStates(targetPlayer);
        }

        return(retVal);
    }
Exemplo n.º 6
0
    public PlayerBase FindWinningPlayer()
    {
        PlayerBase retVall = null;

        StateManager targetPlayer = null;

        //Checa primeiro se os dois players tem a mesma vida
        if (charM.players[0].playerStates.health != charM.players[1].playerStates.health)
        {
            //Se nao, entao checa quem tem a menor vida, o outro vira o ganhador
            if (charM.players[0].playerStates.health < charM.players[1].playerStates.health)
            {
                charM.players[1].score++;
                targetPlayer = charM.players[1].playerStates;
                levelUI.AddWinIndicator(1);
            }
            else
            {
                charM.players[0].score++;
                targetPlayer = charM.players[0].playerStates;
                levelUI.AddWinIndicator(0);
            }
            retVall = charM.returnPlayerFromStates(targetPlayer);
        }
        return(retVall);
    }