Remote dveře lze na mapě otevírat a zavírat. Office dveře hráče lze vidět na mapě (ukazují se ale pouze pro hráče 1). PlayerCommandy, které přepínají mezi dvěma stavy mají přidaný parametr state - client tudíž určuje jejich nový stav. Pokud se neshoduje stav v GameEventu se stavem odeslaným v Commandu, zobrazí se v konzoli varování. Client již nečeká na odpověď serveru při změně UI. Connectory se neklonují, oba tily používají stejnou instanci.

This commit is contained in:
Perry 2026-02-21 18:42:44 +01:00
parent 70b5debb22
commit cea56112ea
14 changed files with 112 additions and 48 deletions

View file

@ -4,6 +4,10 @@ namespace FNAF_Server.Map;
public static class MapManager {
private static MapTile[,] map = new MapTile[5, 5];
public static MapTile Get((int x, int y) coords) => map[coords.x, coords.y];
public static MapTile Get(int tileId) => Get(MapTile.IdToCoords(tileId));
private static Dictionary<(int x1, int y1), (int x2, int y2, int value, ConnectorType type)[]> halfConnectors = new(){
[(0, 0)] =[(1, 0, 1, ConnectorType.HALL), (0, 1, 1, ConnectorType.DOOR_REMOTE)],
@ -53,8 +57,9 @@ public static class MapManager {
for (int i = 0; i < 5; i++){
for (int j = 0; j < 5; j++){
Array.ForEach(map[i, j].GetAllConnectors(), c => {
if(c.Tiles.tile1.Id < c.Tiles.tile2.Id)
MapTile tile = map[i, j];
Array.ForEach(tile.GetAllConnectors(), c => {
if(tile.Id < c.OtherTile(tile).Id)
connectors.Add(c);
});
}