public void SwitchFrameEachTime() { cycler = new Cycler(frameTime, 3, beginning); sprite.Expects.Exactly(2).Method(_ => _.DrawNextFrame()); cycler.AddSprite(sprite.MockObject); cycler.Update(beginning + frameTime); cycler.Update(beginning + frameTime * 2); }
public void DontSwitchFramesWhenFrameIntervalHasntPassed() { cycler = new Cycler(frameTime, 3, beginning); var inbetweenFrame = frameTime / 2.0f; sprite.Expects.One.Method(_ => _.DrawNextFrame()); cycler.AddSprite(sprite.MockObject); cycler.Update(beginning + inbetweenFrame); cycler.Update(beginning + frameTime); cycler.Update(beginning + frameTime + inbetweenFrame); }
public void Update() { if (heartRateCycler != null) { heartRateCycler.Update(Time.time); } setGuySplit(); }
public void CyclerAnimatesIndefinitelyWhenTotalCyclesIsZero() { var totalCycles = 0; var attemptedCycles = 5; cycler = new Cycler(frameTime, totalCycles, beginning); sprite.Expects.Exactly(attemptedCycles).Method(_ => _.DrawNextFrame()); cycler.AddSprite(sprite.MockObject); for (var cycle = 1; cycle < attemptedCycles; cycle++) { cycler.Update(beginning + frameTime * cycle); } }
public void CyclerStopsWhenTotalCyclesReached() { var totalCycles = 3; var attemptedCycles = 5; cycler = new Cycler(frameTime, totalCycles, beginning); sprite.Expects.Exactly(totalCycles).Method(_ => _.DrawNextFrame()); cycler.AddSprite(sprite.MockObject); for (var cycle = 1; cycle < attemptedCycles; cycle++) { cycler.Update(beginning + frameTime * cycle); } }
void AnimateShapes(float time) { if (!triangleShowing() && circleCycler.Count() >= triangleWaitTime) { triangleCycler = new DelayedCycler(shapeSpeed, 6, 1f); triangle.visible(true); triangleCycler.AddSprite(triangle); } circleCycler.Update(time); if (triangleShowing()) { triangleCycler.Update(time); } }
public override void Update() { float now = Time.time; wiggler.Update(now); notSameCycler.Update(now); if (solved) { return; } if (shapes.touchedAtSameTime(now) && triangleShowing()) { messagePromptCoordinator.clearTouch(); messagePromptCoordinator.progress("stop shapes from changing"); Handheld.Vibrate(); wiggler.wiggleNow(now); endScene(); } else { messagePromptCoordinator.hintWhenTouched(GameObject => {}, sensor, now, new Dictionary <GameObject, ActionResponsePair[]> { { circle.gameObject, new [] { new ActionResponsePair("stop circle from changing", new[] { "Nope." }) } }, { triangle.gameObject, new [] { new ActionResponsePair("stop triangle from changing", new[] { "Nope." }) } }, }); } AnimateShapes(now); // if touched circle, draw its bright first frame if (sensor.changeInsideSprite(Camera.main, circle)) { circle.setFrame(0); circle.Animate(); } // if touched triangle, ditto if (sensor.changeInsideSprite(Camera.main, triangle) && triangleShowing()) { triangle.setFrame(0); triangle.Animate(); } }
public override void Update() { var touch = new TouchSensor(input, gameObjectFinder); if (touch.insideSprite(Camera.main, buyMusic)) { Application.OpenURL("http://itunes.apple.com/us/album/same-not-same-ep/id533347009"); } else if (touch.insideSprite(Camera.main, news)) { Application.OpenURL("http://themakingofthemakingof.com"); } else if (touch.hasTaps()) { endScene(); } if (cycle_title.Complete()) { animateStartButton(); } cycle_title.Update(Time.time); }