private void PlaceRoom(Vector2 roomCordinates, int directionIndex) { //Sets the direction Vector based on the direction specified by the properties Vector2 direction = Vector2.zero; Vector2 resultingRoom; direction = Direction(directionIndex); resultingRoom = roomCordinates + direction; RoomPlacementGrid[(int)resultingRoom.x, (int)resultingRoom.y] = 1; CreatedRooms.Add(new Vector2((int)resultingRoom.x, (int)resultingRoom.y)); }
private void PlaceSpecialRoom(int roomIndex) { int chosenRoomNumber, chosenDirection; //variables to hold the random values do { chosenRoomNumber = Random.Range(0, CreatedRooms.Count); chosenDirection = Random.Range(1, 5); //Checks if the selected slot is occupied or not } while (ObstructedAndNeighbours(CreatedRooms[chosenRoomNumber], chosenDirection)); Vector2 resultingRoom = CreatedRooms[chosenRoomNumber] + Direction(chosenDirection); RoomPlacementGrid[(int)resultingRoom.x, (int)resultingRoom.y] = roomIndex; CreatedRooms.Add(new Vector2((int)resultingRoom.x, (int)resultingRoom.y)); }
private void PlaceRoom(int x, int y, int roomIndex) { //makes the selected cell 1 and add it to the room list RoomPlacementGrid[x, y] = roomIndex; CreatedRooms.Add(new Vector2(x, y)); }