コード例 #1
0
        public override void _Process(float delta)
        {
            base._Process(delta);

            var velocity = entityMovement.GetVelocity();

            if (velocity == Vector2.Zero && IsPlaying())
            {
                Stop();
            }
            else if (velocity != Vector2.Zero && !IsPlaying())
            {
                var animationToPlay = GetAnimationToPlay(velocity);
                if (animationToPlay == GetAnimation())
                {
                    Play();
                }
                else
                {
                    Play(animationToPlay);
                }
            }
        }