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

@ -1,3 +1,5 @@
using System.Diagnostics;
using FNAF_Server.Enemies;
using FNAF_Server.Map;
using GlobalClassLib;
using PacketLib;
@ -7,10 +9,19 @@ namespace FNAF_Server;
public class GameLogic {
public const int START_CAMERA = 12;
private static MovementOpportunity secondCycleTimer = new(1000);
public static bool NSecondUpdate{ get; private set; } = false;
public static MapTile P1Office;
public static MapTile P2Office;
public static MapTile[] Offices =>[P1Office, P2Office];
public static void Init() {
// Create map
MapManager.InitMap();
P1Office = MapManager.Get(10);
P2Office = MapManager.Get(14);
//Send map to client
TileConnector[] connectors = MapManager.GetAllConnectors();
@ -20,13 +31,21 @@ public class GameLogic {
connectorsConverted[i * 3 + 1] = connectors[i].Tiles.tile2.Id;
connectorsConverted[i * 3 + 2] = (int)connectors[i].Type;
}
Server.SendPacket(new MapInitPacket{Connectors = connectorsConverted, UpsideDown = true}, Server.P1.peer);
Server.SendPacket(new MapInitPacket{Connectors = connectorsConverted, UpsideDown = false}, Server.P2.peer);
Server.SendPacket(new MapInitPacket{Connectors = connectorsConverted, UpsideDown = false}, Server.P1.peer);
Server.SendPacket(new MapInitPacket{Connectors = connectorsConverted, UpsideDown = true}, Server.P2.peer);
// EnemyManager.AddEnemy(new LurkEnemy(0)).Spawn(MapManager.Get(12));
EnemyManager.AddEnemy(new NekoEnemy(10)).Spawn(MapManager.Get(2));
EnemyManager.AddEnemy(new SpotEnemy(0)).Spawn(MapManager.Get(12));
secondCycleTimer.Start();
}
public static void Update() {
if(secondCycleTimer.Check()) NSecondUpdate = true;
EnemyManager.Update();
NSecondUpdate = false;
}
}