public override void Update(GameTime gameTime, GameInfo gameInfo) { if (Properties != null) { if (Info.AnimationProperty != Util.GetEngineNull() && CurrentAnimationKey != Properties[Info.AnimationProperty].GetAsString()) { CurrentAnimationKey = Properties[Info.AnimationProperty].GetAsString(); CurrentAnimation = ContentLoader.GetAnimation(CurrentAnimationKey); if (CurrentAnimation != null) { CurrentAnimation.Play(); } else { CurrentAnimation = Info.DefaultAnimation; } } } foreach (ComponentInfo component in Components) { component.Update(gameTime, gameInfo); } base.Update(gameTime, gameInfo); }
public override void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera) { CalculateCurrentOrientation(camera); string s = currentMode + OrientationStrings[(int)CurrentOrientation]; if (Animations.ContainsKey(s)) { CurrentAnimation = Animations[s]; CurrentAnimation.Play(); SpriteSheet = CurrentAnimation.SpriteSheet; } base.Update(gameTime, chunks, camera); }
public bool PlayAnimation(bool play) { if (CurrentAnimation == null) { return(false); } if (play) { CurrentAnimation.Play(); return(true); } CurrentAnimation.Pause(); return(false); }
public void Play(string name, bool forceRestart = false) { if (name == null || !_animations.ContainsKey(name)) { //TODO: Logger return; } Animation newAnimation = _animations[name]; if (CurrentAnimation != newAnimation) { newAnimation.Reset(); } CurrentAnimation = newAnimation; CurrentAnimation.Play(forceRestart); }