36 lines
987 B
C#
36 lines
987 B
C#
using Godot;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
public partial class ShootShortbow : PegAction
|
|
{
|
|
public override void _Ready()
|
|
{
|
|
base._Ready();
|
|
_category = "attack";
|
|
_priority = 1;
|
|
_cost = 2;
|
|
_range = 2;
|
|
_usesMax = 1;
|
|
_usesRemaining = _usesMax;
|
|
}
|
|
|
|
public override Tween CreateAnimation(Peg PEG)
|
|
{
|
|
MapCell target = Target(PEG);
|
|
Tween subtween = CreateTween();
|
|
subtween.TweenProperty(_image, "visible", true, 0.0f);
|
|
subtween.TweenProperty(_image, "rotation", PEG.GetAngleTo(target.GlobalPosition), 0.0f);
|
|
subtween.TweenProperty(_image, "global_position", target.GlobalPosition, 0.5f);
|
|
subtween.TweenCallback(Callable.From(() =>
|
|
{
|
|
PEG._pegController._playerController.ChangeHealth(-2, this);
|
|
Position = Vector2.Zero;
|
|
Visible = false;
|
|
}));
|
|
return subtween;
|
|
}
|
|
|
|
}
|