IEnumerator Sequence(GameAction action) { this.PostNotification(beginSequenceNotification, action); if (action.Validate() == false) { action.CancelAction(); } var phase = MainPhase(action.Prepare); while (phase.MoveNext()) { yield return(null); } phase = MainPhase(action.Perform); while (phase.MoveNext()) { yield return(null); } phase = MainPhase(action.Cancel); while (phase.MoveNext()) { yield return(null); } if (rootAction == action) { phase = EventPhase(deathReaperNotification, action, true); while (phase.MoveNext()) { yield return(null); } } this.PostNotification(endSequenceNotification, action); }