public void Assimilate(mazeRoom room) { for (int i = 0; i < room.cells.Count; i++) { Add(room.cells[i]); } }
private mazeRoom CreateRoom(int indexToExclude) { mazeRoom newRoom = ScriptableObject.CreateInstance <mazeRoom>(); newRoom.settingsIndex = Random.Range(0, roomSettings.Length); if (newRoom.settingsIndex == indexToExclude) { newRoom.settingsIndex = (newRoom.settingsIndex + 1) % roomSettings.Length; } newRoom.settings = roomSettings[newRoom.settingsIndex]; rooms.Add(newRoom); return(newRoom); }
private void CreatePassageInSameRoom(mazeCell cell, mazeCell otherCell, mazeDirection direction) { mazePassage passage = Instantiate(passagePrefab) as mazePassage; passage.Initialize(cell, otherCell, direction); passage = Instantiate(passagePrefab) as mazePassage; passage.Initialize(otherCell, cell, direction.GetOpposite()); if (cell.room != otherCell.room) { mazeRoom roomToAssimilate = otherCell.room; cell.room.Assimilate(roomToAssimilate); rooms.Remove(roomToAssimilate); Destroy(roomToAssimilate); } }
public void Initialize(mazeRoom room) { room.Add(this); transform.GetChild(0).GetComponent <Renderer>().material = room.settings.floorMaterial; }