28 lines
1.2 KiB
C#
28 lines
1.2 KiB
C#
|
|
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();
|
||
|
|
}
|