První 3 monstra z plánovaných pěti. Kompletní pathfinding i zrcadlení do clienta. Útoky implementované nejsou. Lurk a Neko jsou hardcoded aby útočili na P1.

This commit is contained in:
Perry 2026-03-08 16:55:49 +01:00
parent 4484b127c5
commit 9bfe63a166
27 changed files with 772 additions and 47 deletions

View file

@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.Data;
using System.Linq;
using FNAF_Clone.GUI;
using FNAF_Clone.Map;
using GlobalClassLib;
using Microsoft.Xna.Framework;
namespace FNAF_Clone;
public class ClientEnemyManager {
private static Dictionary<int, ClientEnemy> enemies = new();
private static Point cameraCorner = new Point(64, 64);
public static void AddEnemy(ClientEnemy enemy) {
enemies.Add(enemy.Id, enemy);
UIManager.AddEnemySprite(enemy.Id, enemy.Sprite);
}
public static void AddEnemyByTemplate(EnemyType type, int id, int difficulty, MapTileProjection location) {
switch (type){
case EnemyType.LURK:
AddEnemy(new ClientEnemy((int)type, "Lurk", id, new UIElement(UIManager.enemyAtlas[0], cameraCorner), difficulty, location));
break;
case EnemyType.NEKO:
AddEnemy(new ClientEnemy((int)type, "Neko", id, new UIElement(UIManager.enemyAtlas[1], cameraCorner), difficulty, location));
break;
case EnemyType.SPOT:
UIElement element =
new UIElement([UIManager.enemyAtlas[2], UIManager.enemyAtlas[3], UIManager.enemyAtlas[4], UIManager.enemyAtlas[5]], cameraCorner);
element.SetTexture(2);
AddEnemy(new ClientEnemy((int)type, "Spot", id, element, difficulty, location));
break;
}
}
public static void Move(int id, MapTileProjection tile) {
enemies[id].Location = tile;
}
public static ClientEnemy Get(int id) => enemies[id];
public static ClientEnemy[] GetByLocation(MapTileProjection tile) {
List<ClientEnemy> output = new();
foreach (var e in enemies.Values){
if (e.Location == tile){
output.Add(e);
}
}
return output.ToArray();
}
}