public void TestPauseResume() { var spriteComp = CreateSpriteComponent(15); SpriteAnimation.Play(spriteComp, 0, 10, AnimationRepeatMode.PlayOnce, 1); SpriteAnimation.Pause(spriteComp); SpriteAnimation.Draw(new GameTime(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2))); Assert.Equal(0, spriteComp.CurrentFrame); SpriteAnimation.Play(spriteComp, 0, 10, AnimationRepeatMode.PlayOnce, 1); SpriteAnimation.Draw(new GameTime(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2))); Assert.Equal(2, spriteComp.CurrentFrame); SpriteAnimation.Pause(spriteComp); SpriteAnimation.Draw(new GameTime(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2))); Assert.Equal(2, spriteComp.CurrentFrame); SpriteAnimation.Resume(spriteComp); SpriteAnimation.Draw(new GameTime(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2))); Assert.Equal(4, spriteComp.CurrentFrame); }
void Awake() { mother = GetComponentInParent <MotherShipScript>(); anim = GetComponentInChildren <SpriteAnimation>(); anim.playOnEnable = false; anim.Pause(); halfMove = false; }
static int Pause(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); SpriteAnimation obj = (SpriteAnimation)ToLua.CheckObject(L, 1, typeof(SpriteAnimation)); obj.Pause(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary> /// Freeze the active animation on its current frame. /// </summary> public void Pause() { activeAnimation.Pause(); }