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
32
ONDServer/Enemies/EnemyManager.cs
Normal file
32
ONDServer/Enemies/EnemyManager.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using ONDServer.Map;
|
||||
|
||||
namespace ONDServer.Enemies;
|
||||
|
||||
public class EnemyManager {
|
||||
private static Dictionary<int, Enemy> enemies = new();
|
||||
|
||||
public static void Update() {
|
||||
foreach (var pair in enemies){
|
||||
if (pair.Value.Spawned) pair.Value.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public static Enemy AddEnemy(Enemy enemy) {
|
||||
enemies.Add(enemy.Id, enemy);
|
||||
return enemy;
|
||||
}
|
||||
|
||||
public static Enemy[] GetByLocation(MapTile tile) {
|
||||
List<Enemy> output = new();
|
||||
foreach (var e in enemies.Values){
|
||||
if (e.Location == tile){
|
||||
output.Add(e);
|
||||
}
|
||||
}
|
||||
|
||||
return output.ToArray();
|
||||
}
|
||||
|
||||
public static Enemy Get(int id) => enemies[id];
|
||||
public static Enemy[] GetAll() => enemies.Values.ToArray();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue