undergoing a shift to change movement into another action that a peg can perform and giving pegs a list of actions order by priority

This commit is contained in:
2026-06-29 02:43:25 -04:00
parent f6c54e0730
commit ebdff1b200
16 changed files with 148 additions and 110 deletions
+41
View File
@@ -0,0 +1,41 @@
using Godot;
using System;
using System.Collections.Generic;
public partial class BasicMovement : PegAction
{
public override void _Ready()
{
base._Ready();
_healthChange = 0;
_cost = 1;
_range = 2^32;
_usesMax = 2^32;
_usesRemaining = _usesMax;
}
public override Tween CreateAnimation(Peg PEG)
{
List<Vector2I> path = PEG.GetBestPath();
PegController pegController = PEG._pegController;
Map map = pegController._playArea._map;
if (path?.Count == 0)
{
return null;
}
Vector2I cell = path[0];
map.SetCellPeg(cell, PEG);
PEG._path.Add(cell);
Tween subtween = CreateTween();
subtween.TweenProperty(this, "global_position", map.GetCellPositionFromAddress(cell), 0.25f);
return subtween;
}
public override bool MeetsCriteria(Peg PEG)
{
return base.MeetsCriteria(PEG) && PEG._address.Y > PEG._pegController._playArea._map._firstOpenRow;
}
}