Exemple #1
0
    public void switchMove()
    {
        if (!isGameOver())
        {
            if (playerMoved)
            {
                playerMoved = false;
                if (monsterExist("Terrex") && !monsterFreezed())
                {
                    mAI = monster.GetComponent <MonsterAI>();
                    mAI.attack();
                }
                if (!playerFreezed(cpu))
                {
                    enemyAI.enemyAI();
                }
                cpuMoved = true;
                cpu.setIsFreezed(false);
                if (ms != null && ms.getIsFreezed())
                {
                    ms.setIsFreezed(false);
                }
                turn.switchMove();
            }
            else if (cpuMoved)
            {
                cpuMoved = false;
                if (monsterExist("Goblin") && !monsterFreezed())
                {
                    mAI = monster.GetComponent <MonsterAI>();
                    mAI.attack();
                }
                if (!playerFreezed(player))
                {
                    playerAI.playerAI();
                }
                playerMoved = true;
                player.setIsFreezed(false);
                if (ms != null && ms.getIsFreezed())
                {
                    ms.setIsFreezed(false);
                }
                turn.switchMove();
            }

            if (turn.getMove() % 2 == 1 && turn.getTurnChanged())
            {
                enemyAI.setSkillInPath();
                skillManagerPlayer.countdown();
                skillManagerCpu.countdown();
                turn.setTurnChanged(false);
            }
        }
    }