using Godot; using System; public partial class ThrustSpear : PegAction { public override void _Ready() { base._Ready(); _category = "attack"; _priority = 1; _cost = 1; _range = 1; _usesMax = 1; _usesRemaining = _usesMax; } public override Tween CreateAnimation(Peg PEG) { GD.Print(Name); Map map = PEG._pegController._playArea._map; Peg pegTarget = map._addressOccupants[Target(PEG)]; Vector2 target = pegTarget.GlobalPosition; Tween subtween = CreateTween(); subtween.TweenProperty(_image, "visible", true, 0.0f); subtween.TweenProperty(_image, "rotation", PEG.GetAngleTo(target), 0.0f); subtween.TweenProperty(_image, "global_position", target, 0.5f); subtween.TweenCallback(Callable.From(() => { pegTarget.ChangeHealth(-1); _image.Position = Vector2.Zero; _image.Visible = false; })); return subtween; } public override Vector2I Target(Peg PEG) { return PEG.Goal(); } }