implemented more code for adding more pegs, but still a lot of work to do on pathfinding, targeting, map etc.

This commit is contained in:
2026-07-02 03:15:15 -04:00
parent 909f466f92
commit cbdca6f3cb
16 changed files with 170 additions and 50 deletions
+7 -4
View File
@@ -12,12 +12,15 @@ public partial class Spearman : FriendlyPeg
_visibility = 4;
}
public override List<Vector2I> Target()
public override Vector2I Goal()
{
Map map = _pegController._playArea._map;
List<Peg> enemies = [.. _pegController._pegs.Where(p => p._disposition == -_disposition)];
List<Vector2I> neighboring = [.. map._cells.Where(c => enemies.Any(e => (e._address - c).Length() <= 1f))];
List<Vector2I> closest = [.. neighboring.OrderBy(c => (c - _address).Length())];
return closest;
if (enemies.Count == 0)
{
return _address;
}
List<Vector2I> closest = [.. enemies.OrderBy(e => (e._address - _address).Length()).Select(e => e._address)];
return closest[0];
}
}