Na začátku hry se mapa na serveru synchronizuje s mapou u clienta. Rozšířen spritesheet monitoru o remote dveře. Přidána GlobalClassLib pro kód sdílený mezi clientem a serverem. Základ pro implementaci ovládání remote dveří.

This commit is contained in:
Perry 2026-02-14 14:35:29 +01:00
parent 8801a7c919
commit 7e6b3d724b
25 changed files with 374 additions and 67 deletions

View file

@ -0,0 +1,28 @@
using GlobalClassLib;
namespace FNAF_Clone.Map;
public class ClientMapManager {
private static MapTileProjection[,] map = new MapTileProjection[5, 5];
private static MapTileProjection Get((int x, int y) coords) => map[coords.x, coords.y];
public static void InitMap((int id1, int id2, ConnectorType type)[] connectors) {
for (int i = 0; i < 5; i++){
for (int j = 0; j < 2; j++){
map[i, j] = new MapTileProjection(MapTileProjection.CoordsToId(i, j)); // TODO: implement ownership
}
map[i, 2] = new MapTileProjection(MapTileProjection.CoordsToId(i, 2));
for (int j = 3; j < 5; j++){
map[i, j] = new MapTileProjection(MapTileProjection.CoordsToId(i, j));
}
}
foreach (var con in connectors){
(int x, int y) coords1 = MapTileProjection.IdToCoords(con.id1);
(int x, int y) coords2 = MapTileProjection.IdToCoords(con.id2);
map[coords1.x, coords1.y].AddConnector(new TileConnectorProjection(map[coords2.x, coords2.y], con.type));
}
}
public static TileConnectorProjection[] GetConnectors(int tileId) => Get(MapTileProjection.IdToCoords(tileId)).GetAllConnectors();
}

View file

@ -0,0 +1,8 @@
using GlobalClassLib;
namespace FNAF_Clone.Map;
public class MapTileProjection : GlobalMapTile<TileConnectorProjection, MapTileProjection> {
public MapTileProjection(int id) : base(id) {
}
}

View file

@ -0,0 +1,13 @@
using GlobalClassLib;
namespace FNAF_Clone.Map;
public class TileConnectorProjection : GlobalTileConnector<MapTileProjection, TileConnectorProjection> {
public TileConnectorProjection(MapTileProjection tile1, MapTileProjection tile2, ConnectorType type) : base(tile1, tile2, type) {
}
public TileConnectorProjection(MapTileProjection tile2, ConnectorType type) : base(tile2, type) {
}
public override TileConnectorProjection Clone() => new(Tiles.tile1, Tiles.tile2, Type);
}