IEnumerator ApplyActions() { m_IsApplyingAction = true; BattleAction action = BattleManagerProxy.Get().DequeueAction(); while (action != null) { if (action.m_Source.IsDead() || action.m_Target.IsDead()) { action = BattleManagerProxy.Get().DequeueAction(); continue; } Animator source = m_Animators[action.m_Source]; Animator target = m_Animators[action.m_Target]; switch (action.m_Type) { case EAction.Attack: Assert.IsTrue(source != target); source.SetTrigger("Attack"); target.SetTrigger("Hit"); break; case EAction.Defense: source.SetTrigger("Heal"); break; case EAction.Heal: case EAction.Protect: if (source != target) { source.SetTrigger("Defense"); target.SetTrigger("Heal"); } else { source.SetTrigger("Heal"); } break; case EAction.Bound: Assert.IsTrue(source != target); source.SetTrigger("Attack"); target.SetTrigger("Heal"); break; } // All animations are 1 second long yield return(new WaitForSeconds(m_AnimationTime)); action.ApplyAction(); action = BattleManagerProxy.Get().DequeueAction(); } BattleManagerProxy.Get().TurnEnd(); ChangeTurn(); m_IsApplyingAction = false; }