Eventy upraveny pro podporu dvou hráčů. Všechny dveře se zobrazují na správných pozicích pro oba hráče.
This commit is contained in:
parent
cea56112ea
commit
3049417914
18 changed files with 157 additions and 75 deletions
|
|
@ -6,7 +6,7 @@ public static class MapManager {
|
|||
private static MapTile[,] map = new MapTile[5, 5];
|
||||
|
||||
public static MapTile Get((int x, int y) coords) => map[coords.x, coords.y];
|
||||
public static MapTile Get(int tileId) => Get(MapTile.IdToCoords(tileId));
|
||||
public static MapTile Get(int tileId) => Get(IdToCoords(tileId));
|
||||
|
||||
|
||||
private static Dictionary<(int x1, int y1), (int x2, int y2, int value, ConnectorType type)[]> halfConnectors = new(){
|
||||
|
|
@ -30,11 +30,11 @@ public static class MapManager {
|
|||
public static void InitMap() { // TODO: make map size not hardcoded
|
||||
for (int i = 0; i < 5; i++){
|
||||
for (int j = 0; j < 2; j++){
|
||||
map[i, j] = new MapTile(MapTile.CoordsToId(i, j), null); // TODO: implement ownership
|
||||
map[i, j] = new MapTile(CoordsToId(i, j), null); // TODO: implement ownership
|
||||
}
|
||||
map[i, 2] = new MapTile(MapTile.CoordsToId(i, 2), null);
|
||||
map[i, 2] = new MapTile(CoordsToId(i, 2), null);
|
||||
for (int j = 3; j < 5; j++){
|
||||
map[i, j] = new MapTile(MapTile.CoordsToId(i, j), null);
|
||||
map[i, j] = new MapTile(CoordsToId(i, j), null);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -69,4 +69,7 @@ public static class MapManager {
|
|||
}
|
||||
|
||||
|
||||
public const int ID_X_OFFSET = 5; // map grid height
|
||||
public static int CoordsToId(int x, int y) => x * ID_X_OFFSET + y;
|
||||
public static (int, int) IdToCoords(int id) => (id / ID_X_OFFSET, id % ID_X_OFFSET);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue