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:
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user