public override void SetAnimation()
 {
     AtlasPlayer.Play(_actions["SingleAction"]);
 }
Пример #2
0
        public virtual void SetAnimation()
        {
            IHasInput hasInput = _sprite as IHasInput;


            if (IsMeleeAttacking && _sprite.Mover.IsMovingRight)
            {
                AtlasPlayer.Play(_actions["MeleeRight"]);
            }
            else if (IsMeleeAttacking && _sprite.Mover.IsMovingLeft)
            {
                AtlasPlayer.Play(_actions["MeleeLeft"]);
            }
            else if (IsRangedAttacking && _sprite.Mover.IsMovingRight)
            {
                AtlasPlayer.Play(_actions["RangedRight"]);
            }
            else if (IsRangedAttacking && _sprite.Mover.IsMovingLeft)
            {
                AtlasPlayer.Play(_actions["RangedLeft"]);
            }
            else if (IsBlocking && _sprite.Mover.IsMovingRight)
            {
                AtlasPlayer.Play(_actions["BlockRight"]);
            }
            else if (IsBlocking && _sprite.Mover.IsMovingLeft)
            {
                AtlasPlayer.Play(_actions["BlockLeft"]);
            }
            else if (_sprite.Mover.Velocity.Y < 0)
            {
                AtlasPlayer.Play(_actions["Jump"]);
            }
            else if (_sprite.Mover.Velocity.X > 0 || _sprite.Mover.Velocity.X < 0)
            {
                if (_sprite.Mover.Velocity.Y < 0)
                {
                    AtlasPlayer.Play(_actions["Jump"]);
                }
                else if (_sprite.Mover.Velocity.X > 0)
                {
                    AtlasPlayer.Play(_actions["WalkRight"]);
                }
                else
                {
                    AtlasPlayer.Play(_actions["WalkLeft"]);
                }
            }
            else if (_sprite.Mover.Velocity.X == 0 && _sprite.Mover.Velocity.Y == 0)
            {
                if (_sprite.Mover.IsMovingLeft && !_sprite.Mover.IsMovingRight)
                {
                    AtlasPlayer.Play(_actions["WalkLeft"]);
                    AtlasPlayer.Stop();
                }
                else if (!_sprite.Mover.IsMovingLeft && _sprite.Mover.IsMovingRight)
                {
                    AtlasPlayer.Play(_actions["WalkRight"]);
                    AtlasPlayer.Stop();
                }
                else
                {
                    AtlasPlayer.Play(_actions["WalkRight"]);
                    AtlasPlayer.Stop();
                }
            }
        }