Esempio n. 1
0
    IEnumerator BattleLevelRoutine()
    {
        Debug.Log("BATTLE LEVEL");

        if (!narrator.IsNarrating)
        {
            narrator.Narrate("Enemy Encountered...!");
        }

        if (battleEvent != null)
        {
            battleEvent.Invoke();
            // Initiate battle UI
        }

        while (narrator.IsNarrating)
        {
            yield return(null);
        }

        yield return(new WaitForSeconds(initBattleDelay));

        turnStateMachine.Initialize();
        while (m_isBattle)
        {
            yield return(StartCoroutine(turnStateMachine.RoundRoutine()));
        }

        yield return(new WaitForSeconds(0.5f));

        // Finish Battle will be called when player won the battle
        while (PlayerManager.instance.allDead)
        {
            yield return(null);
        }
        FinishBattle();

        yield return(new WaitForSeconds(2f));


        if (PlayerManager.instance.activeCharacter)
        {
            UIManager.instance.rewardWindow.GetComponent <RewardWindow>().OpenWindow();
        }

        if (battleOverEvent != null)
        {
            battleOverEvent.Invoke();
        }
        PlayerManager.instance.SetActiveCharacterAtPos(1);
        PlayerManager.instance.activeCharacter.speaker.FixedSpeak("Full of zombies....be careful. Let's keep going...!");
    }