public void SetAdjacentRoomWalls(Vector2 pos) { int right = (int)pos.x; int up = (int)pos.y; GameObject roomObject = representation.rooms[right, up]; if (up + 1 <= grid.rows - 1 && ship.GetRoom(new Vector2(right, up + 1)) != null) { SetRoomWalls(new Vector2(right, up + 1)); } if (right + 1 <= grid.cols - 1 && ship.GetRoom(new Vector2(right + 1, up)) != null) { SetRoomWalls(new Vector2(right + 1, up)); } if (up - 1 >= 0 && ship.GetRoom(new Vector2(right, up - 1)) != null) { SetRoomWalls(new Vector2(right, up - 1)); } if (right - 1 >= 0 && ship.GetRoom(new Vector2(right - 1, up)) != null) { SetRoomWalls(new Vector2(right - 1, up)); } }