using FNAF_Server.Map; namespace FNAF_Server.Enemies; public abstract class Pathfinder { public Enemy Enemy; public Pathfinder(Enemy enemy) { Enemy = enemy; } public abstract Decision DecideNext(MapTile goal); // protected abstract Dictionary Crawl(MapTile tile); // fill Distances with all reachable tiles protected virtual List GetNeighbours(MapTile tile, Predicate connectorFilter, Predicate tileFilter) { return tile.GetAllConnectors().Where(c => connectorFilter(c)).Select(c => c.OtherTile(tile)).Where(t => tileFilter(t)).ToList(); } public class Decision { public int type; public MapTile? nextTile; public ServerPlayer? attackTarget; private Decision() { } public static Decision Move(MapTile tile) => new() { type = MoveType, nextTile = tile }; public static Decision Attack(ServerPlayer player) => new(){ type = AttackType, attackTarget = player }; public static Decision Reset() => new(){ type = ResetType }; public static Decision Wait() => new(){ type = WaitType }; public const int MoveType = 0; public const int AttackType = 1; public const int ResetType = 2; public const int WaitType = 3; } }