示例#1
0
    private IEnumerator messageProcessor()
    {
        while (true)
        {
            if (battleEventQueue.Count > 0 && battleControlsComponent.isReady)
            {
                battleControlsComponent.isReady = false;
                BattleEvent battleEvent = battleEventQueue.Dequeue();

                if (battleEvent.GetType() == typeof(PlayerMustWaitEvent))
                {
                    battleControlsComponent.blockPlayer();
                }
                else if (battleEvent.GetType() == typeof(TextMessageEvent))
                {
                    battleControlsComponent.displayMessage(((TextMessageEvent)battleEvent).textMessage);
                }
                else if (battleEvent.GetType() == typeof(MoveEvent))
                {
                    battleControlsComponent.slowlyReduceHp(((MoveEvent)battleEvent).pokemon);
                }
                else if (battleEvent.GetType() == typeof(FaintEvent))
                {
                    //StartCoroutine(pokemonManager.faintPokemon(((FaintEvent)battleEvent).faintTarget));
                }
            }
            yield return(new WaitForSeconds(0.5f));
        }
    }