implemented visibility, so pegs can only scope out as far as they can see.
This commit is contained in:
@@ -9,7 +9,6 @@ public partial class BasicMovement : PegAction
|
||||
base._Ready();
|
||||
_category = "movement";
|
||||
_priority = 0;
|
||||
_healthChange = 0;
|
||||
_cost = 1;
|
||||
_range = 2^32;
|
||||
_usesMax = 2^32;
|
||||
@@ -17,23 +16,28 @@ public partial class BasicMovement : PegAction
|
||||
}
|
||||
|
||||
public override Tween CreateAnimation(Peg PEG)
|
||||
{
|
||||
PegController pegController = PEG._pegController;
|
||||
Map map = pegController._playArea._map;
|
||||
Vector2I cell = PEG._path[0];
|
||||
Tween subtween = CreateTween();
|
||||
subtween.TweenProperty(PEG, "global_position", map.GetCellPositionFromAddress(cell), 0.25f);
|
||||
PEG._path.RemoveAt(0);
|
||||
return subtween;
|
||||
}
|
||||
|
||||
public override void DoImmediately(Peg PEG)
|
||||
{
|
||||
List<Vector2I> path = PEG.GetBestPath();
|
||||
PegController pegController = PEG._pegController;
|
||||
Map map = pegController._playArea._map;
|
||||
if (path?.Count == 0)
|
||||
{
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
Vector2I cell = path[0];
|
||||
|
||||
map.SetCellPeg(cell, PEG);
|
||||
PEG._path.Add(cell);
|
||||
|
||||
Tween subtween = CreateTween();
|
||||
subtween.TweenProperty(PEG, "global_position", map.GetCellPositionFromAddress(cell), 0.25f);
|
||||
|
||||
return subtween;
|
||||
}
|
||||
|
||||
public override bool MeetsCriteria(Peg PEG)
|
||||
|
||||
@@ -9,7 +9,6 @@ public partial class Shortbow : PegAction
|
||||
base._Ready();
|
||||
_category = "attack";
|
||||
_priority = 1;
|
||||
_healthChange = -1;
|
||||
_cost = 2;
|
||||
_range = 1;
|
||||
_usesMax = 1;
|
||||
@@ -24,7 +23,7 @@ public partial class Shortbow : PegAction
|
||||
subtween.TweenProperty(_image, "global_position", target, 0.5f);
|
||||
subtween.TweenCallback(Callable.From(() =>
|
||||
{
|
||||
PEG._pegController._playerController.ChangeHealth(_healthChange, this);
|
||||
PEG._pegController._playerController.ChangeHealth(-1, this);
|
||||
Position = Vector2.Zero;
|
||||
Visible = false;
|
||||
}));
|
||||
|
||||
@@ -9,7 +9,6 @@ public partial class Shortsword : PegAction
|
||||
base._Ready();
|
||||
_category = "attack";
|
||||
_priority = 1;
|
||||
_healthChange = -2;
|
||||
_cost = 2;
|
||||
_range = 0;
|
||||
_usesMax = 1;
|
||||
@@ -18,14 +17,14 @@ public partial class Shortsword : PegAction
|
||||
|
||||
public override Tween CreateAnimation(Peg PEG)
|
||||
{
|
||||
Vector2 target = PEG._disposition * Vector2.Up * PEG._pegController._playArea._map._cellSize;
|
||||
GD.Print(target);
|
||||
Vector2 target = PEG._disposition * Vector2.Down * PEG._pegController._playArea._map._cellSize;
|
||||
// GD.Print(target);
|
||||
Tween subtween = CreateTween();
|
||||
subtween.TweenProperty(_image, "visible", true, 0.0f);
|
||||
subtween.TweenProperty(_image, "position", target, 0.5f);
|
||||
subtween.TweenCallback(Callable.From(() =>
|
||||
{
|
||||
PEG._pegController._playerController.ChangeHealth(_healthChange, this);
|
||||
PEG._pegController._playerController.ChangeHealth(-2, this);
|
||||
_image.Position = Vector2.Zero;
|
||||
_image.Visible = false;
|
||||
}));
|
||||
|
||||
@@ -7,5 +7,6 @@ public partial class Archer : HostilePeg
|
||||
{
|
||||
base._Ready();
|
||||
_stamina = 2;
|
||||
_visibility = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@ public partial class Infantry : HostilePeg
|
||||
{
|
||||
base._Ready();
|
||||
_stamina = 3;
|
||||
_visibility = 3;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -4,7 +4,7 @@ using System;
|
||||
public partial class PegAction : Node2D
|
||||
{
|
||||
public string _category;
|
||||
public int _priority, _healthChange, _cost, _range, _usesMax, _usesRemaining, _triggers = 0;
|
||||
public int _priority, _cost, _range, _usesMax, _usesRemaining, _triggers = 0;
|
||||
public Sprite2D _image;
|
||||
|
||||
public override void _Ready()
|
||||
@@ -18,6 +18,11 @@ public partial class PegAction : Node2D
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual void DoImmediately(Peg PEG)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual bool MeetsCriteria(Peg PEG)
|
||||
{
|
||||
return PEG._staminaRemaining >= _cost
|
||||
|
||||
Reference in New Issue
Block a user