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:
parent
8801a7c919
commit
7e6b3d724b
25 changed files with 374 additions and 67 deletions
28
FNAF_Clone/Map/ClientMapManager.cs
Normal file
28
FNAF_Clone/Map/ClientMapManager.cs
Normal 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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue