public void Update(float deltaTime) { currentAnimation.Update(deltaTime); if (prevFrameIndex != currentAnimation.CurrentFrame) { ShowSprite(currentAnimation.CurrentFrameName); prevFrameIndex = currentAnimation.CurrentFrame; } }
public void Update(float deltaTime) { int newAnimation = (int)character.CharFacing; if (character.IsWalking) { newAnimation += 10; } // TODO: What is the acceptable amount of O2 gas pressure? // Using .15 from Need.cs for now. if (character.CurrTile.GetGasPressure("O2") >= 0.15f) { newAnimation += 100; // Remove helmet } // check if we need to switch animations if (newAnimation != (int)currentAnimationType) { currentAnimationType = (AnimationType)newAnimation; currentAnimation = animations[currentAnimationType]; // Make sure we update the sprite prevFrameIndex = -1; if (currentAnimation.FlipX == true && renderer.flipX == false) { renderer.flipX = true; } else if (currentAnimation.FlipX == false && renderer.flipX == true) { renderer.flipX = false; } } currentAnimation.Update(deltaTime * character.MovementSpeed); if (prevFrameIndex != currentAnimation.CurrentFrame) { ShowSprite(currentAnimation.CurrentFrameName); prevFrameIndex = currentAnimation.CurrentFrame; } }
public void Update(float deltaTime) { currentAnimation.Update(deltaTime); CheckFrameChange(); }