Bugfixy, odstranění nepoužívaných tříd CameraSystem a ITargetingEnemy, přidání dedikované třídy ReturnToMenuElement, předělání pathfinding algoritmu z DFS na BFS, přesun správy obtížnosti do abstraktní třídy Enemy, přidání scriptů pro kompilaci na aplikaci nevyžadující dotnet

This commit is contained in:
Perry 2026-03-25 16:37:18 +01:00
parent ceac37920b
commit e5d746d597
24 changed files with 258 additions and 138 deletions

View file

@ -6,9 +6,13 @@ namespace ONDServer.Enemies;
public abstract class Enemy : GlobalEnemy<MapTile, TileConnector> {
public int Difficulty { get; protected set; }
protected MovementOpportunity movementOpportunity;
protected Enemy(int difficulty) {
Difficulty = difficulty;
protected Enemy(int difficulty, int movementInterval) {
movementOpportunity = new(movementInterval);
SetDifficulty(difficulty);
}
public abstract bool BlocksTile { get; set; }
@ -30,6 +34,9 @@ public abstract class Enemy : GlobalEnemy<MapTile, TileConnector> {
Server.SendUpdateToAll([GameEvent.ENEMY_ATTACK(Id, player.state.pid)]);
GameLogic.DeclareWinner(Server.OtherPlayer(player));
}
public abstract void SetDifficulty(int difficulty);
public virtual void SetDifficulty(int difficulty) {
Difficulty = difficulty;
movementOpportunity.MovementChance = ((5 + Math.Pow(1.5f, Difficulty)) * Math.Sign(Difficulty)) / (5 + Math.Pow(1.5f, 10));
}
}