IEnumerator PerformAct()        // to use coroutine
    {
        yield return(new WaitForSeconds(.75f));

        if (GetCurrentCharacter().health > 0)                   // check to see if you're alive
        {
            GetCurrentCharacter().GetComponent <Enemy>().Act(); // if you're alive then act
        }
        uIController.UpdateCharacterUI();
        yield return(new WaitForSeconds(1f));

        NextAct(); //Lesson 10 says we don't need this but it was in the tutorial when we set it up in Lesson 6 @ 10:45
    }
Exemple #2
0
    IEnumerator PerformAct()
    {
        yield return(new WaitForSeconds(.75f));

        if (GetCurrentCharacter().health > 0)
        {
            GetCurrentCharacter().GetComponent <Enemy>().Act();
        }
        uiController.UpdateCharacterUI();
        yield return(new WaitForSeconds(1f));

        NextAct();
    }
Exemple #3
0
    //add a delay while everything else works in the background and come back to this method
    IEnumerator PerformAct()
    {
        //wait for 3/4 of a second
        yield return(new WaitForSeconds(.75f));

        //check if the character acting is not dead
        if (GetCurrentCharacter().health > 0)
        {
            //do an action
            GetCurrentCharacter().GetComponent <Enemy>().Act();
        }

        //update character UI based on progress of battle
        uiController.UpdateCharacterUI();

        //wait a second after the turn is complete
        yield return(new WaitForSeconds(1f));

        //go to the next character that can act
        NextAct();
    }