Пример #1
0
    public void getTurn()
    {
        //if % = 0, then its Warrior turn
        if (currentTurn % 4 == 0)
        {
            playerAttackStat  = WarriorScript.getAttackStat();
            playerDefenseStat = WarriorScript.getDefenseStat();
            playerSpeedStat   = WarriorScript.getSpeedStat();
            playerMagicStat   = WarriorScript.getMagicStat();
            playerCurrentHP   = WarriorScript.getCurrentHP();
            playerMaxHP       = WarriorScript.getMaxHP();
            playerCurrentMP   = WarriorScript.getCurrentMP();
            playerMaxMP       = WarriorScript.getMaxMP();
        }        //end if

        //if % = 1, then its Mage turn
        if (currentTurn % 4 == 1)
        {
            playerAttackStat  = MageScript.getAttackStat();
            playerDefenseStat = MageScript.getDefenseStat();
            playerSpeedStat   = MageScript.getSpeedStat();
            playerMagicStat   = MageScript.getMagicStat();
            playerCurrentHP   = MageScript.getCurrentHP();
            playerMaxHP       = MageScript.getMaxHP();
            playerCurrentMP   = MageScript.getCurrentMP();
            playerMaxMP       = MageScript.getMaxMP();
        }        //end if

        //if % = 2, then its Enemy1 turn
        if (currentTurn % 4 == 2 && EnemyScript.getCurrentHP() > 0)
        {
            int randomTarget;
            randomTarget = Random.Range(1, 100);
            print(randomTarget);


            if (randomTarget <= 50)
            {
                WarriorScript.setHP(WarriorScript.getCurrentHP() - EnemyScript.getAttackStat() + WarriorScript.getDefenseStat() - 10);
            }            //end if
            if (randomTarget > 50)
            {
                MageScript.setHP(MageScript.getCurrentHP() - EnemyScript.getAttackStat() + MageScript.getDefenseStat() - 10);
            }    //end if
            currentTurn++;
        }        //end if
        else if (currentTurn % 4 == 2)
        {
            currentTurn++;
        }

        //if % = 3, then its Enemy2 turn
        if (currentTurn % 4 == 3 && Enemy2Script.getCurrentHP() > 0)
        {
            int randomTarget;
            randomTarget = Random.Range(1, 100);
            print(randomTarget);

            if (randomTarget <= 50)
            {
                WarriorScript.setHP(WarriorScript.getCurrentHP() - Enemy2Script.getAttackStat() + WarriorScript.getDefenseStat() - 10);
            }            //end if
            if (randomTarget > 50)
            {
                MageScript.setHP(MageScript.getCurrentHP() - Enemy2Script.getAttackStat() + MageScript.getDefenseStat() - 10);
            }    //end if
            currentTurn++;
        }        //end if
        else if (currentTurn % 4 == 3)
        {
            currentTurn++;
        }
    }//end getTurn