public static void Play(Entity e, string animationName = "") { SpriteSheetAnimator animator = SpriteSheetCache.GetAnimator(e); if (animationName == "") { animationName = animator.animations[animator.currentAnimationIndex].name; } int i = 0; foreach (SpriteSheetAnimationData animation in animator.animations) { if (animation.animationName == animationName) { SpriteSheetManager.SetAnimation(e, animation, animator.animations[animator.currentAnimationIndex].name); animator.currentAnimationIndex = i; } i++; } }
public static void Play(EntityCommandBuffer buffer, Entity e, BufferHook hook, string animationName = "") { SpriteSheetAnimator animator = SpriteSheetCache.GetAnimator(e); if (animationName == "") { animationName = animator.animations[animator.currentAnimationIndex].name; } int i = 0; foreach (SpriteSheetAnimationData animation in animator.animations) { if (animation.animationName == animationName) { SpriteSheetManager.SetAnimation(buffer, e, animation, hook); animator.currentAnimationIndex = i; return; } i++; } }