Ejemplo n.º 1
0
    public IEnumerator RunSimulation(int playerFirstAttack, int playerSecondAttack, string enemyFirstAttack, string enemySecondAttack, GameObject runner)
    {
        CombatManagerScript.netrixiAttacks = false;
        CombatManagerScript.folkvarAttacks = false;
        CombatManagerScript.ivAttacks      = false;


        // FIRST ATTACK
        yield return(new WaitForSecondsRealtime(moveDelay));

        // Check to see if any Main Characters move for their first attack
        CheckForPlayerMovement(playerFirstAttack, 1);
        // If any Main Characters did move for their first attack
        if (didPlayerMove1)
        {
            yield return(new WaitForSecondsRealtime(moveDelay));
        }

        // Check to see if any Enemy Characters move for their first attack
        CheckForEnemyMovement(enemyFirstAttack, 1);
        // If any Enemy Characters did move for their first attack
        if (didEnemyMove1)
        {
            yield return(new WaitForSecondsRealtime(moveDelay));
        }



        // Check to see what the player's first attack is
        if (!didPlayerMove1)
        {
            AttackScript.PlayerAttack(playerFirstAttack, 1);
            CombatManagerScript.playerAttacking1 = true;

            AttackScript.enemyAttack = !AttackScript.enemyAttack;

            // Wait for attack animation to play
            yield return(new WaitForSecondsRealtime(attack1Delay));
        }

        // Check to see what the enemy's first attack is
        if (!didEnemyMove1)
        {
            AttackScript.EnemyAttack(enemyFirstAttack, 1, enemyAttacker1);
            CombatManagerScript.enemyAttacking1 = true;

            AttackScript.playerAttack = !AttackScript.playerAttack;

            // Wait for attack animation to play
            yield return(new WaitForSecondsRealtime(attack1Delay));
        }



        // SECOND ATTACK

        // Check to see if any Main Characters move for their second attack
        CheckForPlayerMovement(playerSecondAttack, 2);
        // If any Main Characters did move for their second attack
        if (didPlayerMove2)
        {
            yield return(new WaitForSecondsRealtime(moveDelay));
        }

        // Check to see if any Enemy Characters move for their second attack
        CheckForEnemyMovement(enemySecondAttack, 2);
        // If any Enemy Characters did move for their second attack
        if (didEnemyMove2)
        {
            yield return(new WaitForSecondsRealtime(moveDelay));
        }



        // Check to see what the player's second attack is
        if (!didPlayerMove2)
        {
            AttackScript.PlayerAttack(playerSecondAttack, 2);
            CombatManagerScript.playerAttacking2 = true;

            AttackScript.enemyAttack = !AttackScript.enemyAttack;

            // Wait for attack animation to play
            yield return(new WaitForSecondsRealtime(attack2Delay));
        }

        // Check to see what the enemy's second attack is
        if (!didEnemyMove2)
        {
            AttackScript.EnemyAttack(enemySecondAttack, 2, enemyAttacker2);
            CombatManagerScript.enemyAttacking2 = true;

            AttackScript.playerAttack = !AttackScript.playerAttack;

            // Wait for attack animation to play
            yield return(new WaitForSecondsRealtime(attack2Delay));
        }



        // Reset variables once simulation is finished
        CombatManagerScript.firstAttack  = 0;
        CombatManagerScript.secondAttack = 0;

        NetrixiCombatScript.ResetNetrixiVariables();
        FolkvarCombatScript.ResetFolkvarVariables();
        IvCombatScript.ResetIvVariables();

        CombatManagerScript.roundNumber += 1;

        CombatManagerScript.playerAttacking1 = false;
        CombatManagerScript.playerAttacking2 = false;
        CombatManagerScript.enemyAttacking1  = false;
        CombatManagerScript.enemyAttacking2  = false;

        CombatManagerScript.target1Location = 0;
        CombatManagerScript.target2Location = 0;

        CharacterManagerScript.ResetVariables();
        EnemyManagerScript.ClearMoves();

        didPlayerMove1 = false;
        didPlayerMove2 = false;
        didEnemyMove1  = false;
        didEnemyMove2  = false;


        // If only one character is alive
        //if (CombatManagerScript.netrixiAlive && !CombatManagerScript.folkvarAlive && !CombatManagerScript.ivAlive) CombatManagerScript.netrixiAttacks = true;
        //if (!CombatManagerScript.netrixiAlive && CombatManagerScript.folkvarAlive && !CombatManagerScript.ivAlive) CombatManagerScript.folkvarAttacks = true;
        //if (!CombatManagerScript.netrixiAlive && !CombatManagerScript.folkvarAlive && CombatManagerScript.ivAlive) CombatManagerScript.ivAttacks = true;


        Destroy(runner);
    }