IEnumerator MainPhase(Phase phase) { bool isActionCancelled = phase.owner.isCanceled; bool isCancelPhase = phase.owner.cancel == phase; if (isActionCancelled ^ isCancelPhase) // Logical exclusive-OR { yield break; } var reactions = openReactions = new List <GameAction>(); var flow = phase.Flow(container); while (flow.MoveNext()) { yield return(null); } flow = ReactPhase(reactions); while (flow.MoveNext()) { yield return(null); } }
public void PhaseTriggersHandlerWithoutKeyFrame() { var action = new TestAction(10, -1); var phase = new Phase(action, action.KeyFrameHandler); phase.viewer = action.KeyFrameViewer; var flow = phase.Flow(null); while (flow.MoveNext()) { } Assert.IsTrue(action.isComplete); }
public void PhaseRunsCompleteViewerFlow() { var action = new TestAction(10, 5); var phase = new Phase(action, action.KeyFrameHandler); phase.viewer = action.KeyFrameViewer; var flow = phase.Flow(null); while (flow.MoveNext()) { } Assert.AreEqual(action.step, action.loopCount); }
public void RunningPhaseWithoutKeyframe_HandlerIsTriggered() { var action = new TestAction(10, -1); var phase = new Phase(action, action.KeyFrameHandler) { Viewer = action.KeyframeViewer }; var flow = phase.Flow(null); while (flow.MoveNext()) { } Assert.IsTrue(action.IsComplete); }
public void RunningPhase_CompletesViewerFlow() { var action = new TestAction(10, 5); var phase = new Phase(action, action.KeyFrameHandler) { Viewer = action.KeyframeViewer }; var flow = phase.Flow(null); while (flow.MoveNext()) { } Assert.AreEqual(action.Step, action.LoopCount); }
public void PhaseTriggersOnKeyFrame() { var action = new TestAction(10, 5); var phase = new Phase(action, action.KeyFrameHandler); phase.viewer = action.KeyFrameViewer; var flow = phase.Flow(null); while (flow.MoveNext()) { if (action.step < action.keyframe) { Assert.IsFalse(action.isComplete); } else if (action.step > action.keyframe) { Assert.IsTrue(action.isComplete); } } }
public void RunningPhaseWithKeyframe_HandlerIsTriggeredOnKeyframe() { var action = new TestAction(10, 5); var phase = new Phase(action, action.KeyFrameHandler) { Viewer = action.KeyframeViewer }; var flow = phase.Flow(null); while (flow.MoveNext()) { if (action.Step < action.Keyframe) { Assert.IsFalse(action.IsComplete); } else if (action.Step > action.Keyframe) { Assert.IsTrue(action.IsComplete); } } }
private IEnumerator MainPhase(Phase phase) { if (phase.Owner.IsCanceled ^ phase == phase.Owner.CancelPhase) { yield break; } var reactions = _openReactions = new List <GameAction>(); var flow = phase.Flow(Container); while (flow.MoveNext()) { yield return(null); } flow = ReactPhase(reactions); while (flow.MoveNext()) { yield return(null); } }