Exemplo n.º 1
0
 public Corridor(Room room, int size)
 {
     _room = room;
     _prefabSize = room.PrefabSize;
     _corridorLength = size;
     GetCorridorStart();
     BuildCorridor();
     _room.RemoveCorridorWaypoints(CorridorWaypoints);
 }
Exemplo n.º 2
0
        private void CreateRoomCorridors(int levelSize)
        {
            Rooms = new Room[levelSize];
            Corridors = new Corridor[levelSize - 1];

            var roomSize = Random.Range(minRoomSize, maxRoomSize);

            Rooms[0] = new Room(Vector3.zero, roomSize, PrefabSize);
            Corridors[0] = new Corridor(Rooms[0], roomSize - 1);
            Debug.Log("Build First Room And Corridor");

            for (var i = 1; i < levelSize; i++)
            {
                roomSize = Random.Range(minRoomSize, maxRoomSize);
                Rooms[i] = new Room(Corridors[i - 1], roomSize, PrefabSize);
                Debug.Log("Build " + i + " Room");
                if (i < levelSize - 1)
                {
                    Corridors[i] = new Corridor(Rooms[i], roomSize - 1);
                    Debug.Log("Build " + i + " Corridor");
                }
            }
        }