コード例 #1
0
ファイル: Corridor.cs プロジェクト: dwhyte11/FinalYearProject
 public Corridor(Room room, int size)
 {
     _room = room;
     _prefabSize = room.PrefabSize;
     _corridorLength = size;
     GetCorridorStart();
     BuildCorridor();
     _room.RemoveCorridorWaypoints(CorridorWaypoints);
 }
コード例 #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");
                }
            }
        }