Beispiel #1
0
        /// <summary>
        /// Will attempt to create a new room to the north of
        /// the roomToBuildFrom.  If a room already exists at
        /// the coordinate to the north of roomToBuildFrom,
        /// no room will be added.
        /// </summary>
        /// <param name="roomToBuildFrom"></param>
        /// <returns>A room connected to the north of
        /// roomtoBuildFrom if one does not exist at that location.
        /// Otherwise, returns null.</returns>
        private Room BuildNorthRoom(Room roomToBuildFrom)
        {
            Room northRoom = null;

            if (floorBeingBuilt.DoesNotHaveRoomAtCoords(roomToBuildFrom.X, roomToBuildFrom.Y + 1))
            {
                northRoom = new Room(roomToBuildFrom.X, roomToBuildFrom.Y + 1);
                floorBeingBuilt.AddRoom(northRoom);

                return(northRoom);
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
 public void run()
 {
     var floor1 = new Floor(1);
     floor1.AddRoom(new Room(100));
     floor1.AddRoom(new Room(101));
     floor1.AddRoom(new Room(102));
     var floor2 = new Floor(2);
     floor2.AddRoom(new Room(200));
     floor2.AddRoom(new Room(201));
     floor2.AddRoom(new Room(202));
     var myFirmOffice = new OfficeBuilding("[Design Patterns Center]", 25, 990);
     myFirmOffice.AddFloor(floor1);
     myFirmOffice.AddFloor(floor2);
     var electrician = new ElectricitySystemValidator();
     myFirmOffice.Accept(electrician);
     var plumber = new PlumbingSystemValidator();
     myFirmOffice.Accept(plumber);
 }
Beispiel #3
0
    private void Awake()
    {
        //var watch = System.Diagnostics.Stopwatch.StartNew();

        properties = GameObject.FindObjectOfType <Properties>();

        VectArrayBoolInt aux;

        floor = new Floor();

        floor.AddRoom(new Square(new Vector3(0, 0, 0),
                                 new bool[] { false, false, true, false }, 0));

        for (int i = 1; i < properties.NumRoom - 1; i++)
        {
            aux = CardinalSelector(RoomSelector(i - 1));

            switch (aux.innt)
            {
            case 0:
                floor.AddRoom(new Square(aux.vector3, aux.arrayBool, i));
                break;

            case 1:
                floor.AddRoom(new RectangleV(aux.vector3, aux.arrayBool, i));
                break;

            case 2:
                floor.AddRoom(new RectangleH(aux.vector3, aux.arrayBool, i));
                break;

            case 3:
                floor.AddRoom(new Square2(aux.vector3, aux.arrayBool, i));
                break;

            case 4:
                floor.AddRoom(new HexagonalV(aux.vector3, aux.arrayBool, i));
                break;

            case 5:
                floor.AddRoom(new HexagonalH(aux.vector3, aux.arrayBool, i));
                break;

            case 10:
                floor.AddRoom(new Triangle(aux.vector3, aux.arrayBool,
                                           i, Quaternion.identity));
                break;

            case 11:
                floor.AddRoom(new Triangle(aux.vector3, aux.arrayBool,
                                           i, Quaternion.Euler(new Vector3(0, 90, 0))));
                break;

            case 12:
                floor.AddRoom(new Triangle(aux.vector3, aux.arrayBool,
                                           i, Quaternion.Euler(new Vector3(0, 180, 0))));
                break;

            case 13:
                floor.AddRoom(new Triangle(aux.vector3, aux.arrayBool,
                                           i, Quaternion.Euler(new Vector3(0, 270, 0))));
                break;
            }
        }
        aux = BossRoomSelector();
        floor.AddRoom(new Octagon(aux.vector3, aux.arrayBool, properties.NumRoom));
        floor.AddCorridors();
        floor.AddWalls();

        //watch.Stop();
        //var elapsedMs = watch.ElapsedMilliseconds;
        //Debug.Log(elapsedMs);
    }