Remote dveře se renderují na mapě. Opravena chyba v GlobalMapTile.CoordsToId, která způsobovala desynchronizaci id místností
This commit is contained in:
parent
7e6b3d724b
commit
70b5debb22
7 changed files with 58 additions and 27 deletions
|
|
@ -5,7 +5,8 @@ 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) {
|
||||
public static MapTileProjection Get(int tileId) => Get(MapTileProjection.IdToCoords(tileId));
|
||||
public static void InitMap() {
|
||||
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
|
||||
|
|
@ -17,12 +18,18 @@ public class ClientMapManager {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void InitConnectors(TileConnectorProjection[] connectors) {
|
||||
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));
|
||||
// (int x, int y) coords1 = MapTileProjection.IdToCoords(con.Tiles.tile1.Id);
|
||||
// (int x, int y) coords2 = MapTileProjection.IdToCoords(con.Tiles.tile2.Id);
|
||||
map[con.Tiles.tile1.GridPosition.x, con.Tiles.tile1.GridPosition.y].AddConnector(con);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static TileConnectorProjection[] GetConnectors(int tileId) => Get(MapTileProjection.IdToCoords(tileId)).GetAllConnectors();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue