33 lines
No EOL
1.5 KiB
C#
33 lines
No EOL
1.5 KiB
C#
using GlobalClassLib;
|
|
|
|
namespace FNAF_Clone.Map;
|
|
|
|
public class ClientMapManager {
|
|
private static MapTileProjection[,] map = new MapTileProjection[5, 5];
|
|
public static MapTileProjection Get((int x, int y) coords) => map[coords.x, coords.y];
|
|
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
|
|
}
|
|
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));
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void InitConnectors(TileConnectorProjection[] connectors) {
|
|
foreach (var con in connectors){
|
|
// (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 GetConnector((int, int) id) => Get(id.Item1).GetConnector(id.Item2);
|
|
|
|
public static TileConnectorProjection[] GetConnectors(int tileId) => Get(MapTileProjection.IdToCoords(tileId)).GetAllConnectors();
|
|
} |