Пример #1
0
    private void Start()
    {
        Instance = this;

        FloorGenerator floorGen = GetComponent <FloorGenerator>();

        floorCells = floorGen.GenerateFloor();
    }
Пример #2
0
        static void Main(string[] args)
        {
            uint[] buildCommands = new uint[8];

            /*buildCommands[0] = 0x28008000;
            *  buildCommands[1] = 0x22008000;
            *  buildCommands[2] = 0x44008000;*/


            //buildCommands[0] = 0xFFFFC400;


            //buildCommands[0] = 0xFF000000;


            buildCommands[0] = 0x48008000;
            buildCommands[1] = 0x2FF04400;
            buildCommands[2] = 0x42008000;
            buildCommands[3] = 0x2FF04400;
            buildCommands[4] = 0x42008000;
            buildCommands[5] = 0x2FF04400;
            buildCommands[6] = 0x41008000;
            buildCommands[7] = 0x2FF06400;

            FloorGenerator generator = new FloorGenerator(buildCommands, 1000000, 1, true);
            bool           noSuccess = true;

            while (noSuccess)
            {
                try
                {
                    generator.GenerateFloor();
                    noSuccess = false;
                }
                catch (NoRoomsToGenerateFromException)
                {
                    Console.WriteLine("Generation stopped because no more rooms were able to be added.");
                    Floor failedFloor = generator.GetFloor();
                    Room[,] roomsOfFailedFloor = SendFloorToArray(failedFloor);
                    PrintRooms(roomsOfFailedFloor, failedFloor.RoomCount, buildCommands, false);
                    generator.Reset();
                }
            }
            Console.WriteLine("Success!");
            Floor floor = generator.GetFloor();

            Room[,] rooms = SendFloorToArray(floor);
            PrintRooms(rooms, floor.RoomCount, buildCommands, true);
        }