Projekt přejmenován. Neko nastaven na výchozí pozici
This commit is contained in:
parent
1a27dd6fab
commit
ceac37920b
104 changed files with 873 additions and 208 deletions
36
ONDServer/Enemies/Pathfinder.cs
Normal file
36
ONDServer/Enemies/Pathfinder.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using ONDServer.Map;
|
||||
|
||||
namespace ONDServer.Enemies;
|
||||
|
||||
public abstract class Pathfinder {
|
||||
public Enemy Enemy;
|
||||
public Pathfinder(Enemy enemy) {
|
||||
Enemy = enemy;
|
||||
}
|
||||
public abstract Decision DecideNext(MapTile goal);
|
||||
// protected abstract Dictionary<MapTile, int> Crawl(MapTile tile); // fill Distances with all reachable tiles
|
||||
|
||||
protected virtual List<MapTile> GetNeighbours(MapTile tile, Predicate<TileConnector> connectorFilter, Predicate<MapTile> 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;
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue