Example #1
0
 public void Assimilate(mazeRoom room)
 {
     for (int i = 0; i < room.cells.Count; i++)
     {
         Add(room.cells[i]);
     }
 }
Example #2
0
    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);
    }
Example #3
0
    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;
 }