Esempio n. 1
0
    public override void _Process(float delta)
    {
        base._Process(delta);

        var animation = GetNode <AnimatedSprite>("Shadow");

        if (path.Count > 0)
        {
            var motion = IsometricMove.GetMotion(path, Position, delta, MOTION_SPEED);
            animation.Playing = motion.HasValue;
            if (motion.HasValue)
            {
                Position += motion ?? Vector2.Zero;
                var direction = IsometricMove.Animate(motion.Value);
                if (!string.IsNullOrWhiteSpace(direction))
                {
                    animation.Animation = $"move{direction}";
                }
            }
        }
        else if (AttackDirection.HasValue)
        {
            animation.Playing = true;
            var direction = IsometricMove.Animate(AttackDirection.Value);

            if (!string.IsNullOrWhiteSpace(direction))
            {
                animation.Animation = $"attack{direction}";
            }
        }
    }
Esempio n. 2
0
 public void MoveShadowTo(Vector2 newTarget)
 {
     IsometricMove.MoveBy(this.path, Position, newTarget, GetParent <Maze>());
     AttackDirection = null;
     NewPosition     = newTarget;
 }
Esempio n. 3
0
 public void MoveUnitTo(Vector2 newTarget)
 {
     shadow.HideShadow();
     IsometricMove.MoveBy(this.path, Position, newTarget, GetParent <Maze>());
 }