private void SetNextState() { if (_stateQueue.Count > 0) { SPRITE_ANIMATION nextState = _stateQueue.Dequeue(); if (nextState != _currentAnimationState) { SetAnimation(nextState); } } else { switch (_currentAnimationState) { case SPRITE_ANIMATION.WALK_DOWN: SetAnimation(SPRITE_ANIMATION.IDLE_DOWN); break; case SPRITE_ANIMATION.WALK_UP: SetAnimation(SPRITE_ANIMATION.IDLE_UP); break; case SPRITE_ANIMATION.WALK_LEFT: SetAnimation(SPRITE_ANIMATION.IDLE_LEFT); break; case SPRITE_ANIMATION.WALK_RIGHT: SetAnimation(SPRITE_ANIMATION.IDLE_RIGHT); break; } } }
internal void SetAnimation(SPRITE_ANIMATION newAnimationState) { if (newAnimationState != CurrentAnimationState) { CurrentAnimationState = newAnimationState; CurrentAnimation.Reset(); } }
public Sprite(CanvasBitmap image, int imageResolution, PointInt absolutePosition) { AbsolutePosition = absolutePosition; _spriteSheet = new SpriteSheet(image, imageResolution); _currentAnimationState = SPRITE_ANIMATION.IDLE_DOWN; _currentAnimation = SpriteAnimationDefinitions.Copy(_currentAnimationState); }
public static SpriteAnimation Copy(SPRITE_ANIMATION animation) { return(SpriteAnimation.Copy(_animations[animation])); }
public static SpriteAnimation Get(SPRITE_ANIMATION animation) { return(_animations[animation]); }
public void SetAnimation(SPRITE_ANIMATION animation) { _currentAnimationState = animation; _currentAnimation = SpriteAnimationDefinitions.Copy(_currentAnimationState); }