internal static GenerationCommand[] ParseArray(uint[] commands) { GenerationCommand[] toReturn = new GenerationCommand[commands.Length]; for (int i = 0; i < commands.Length; i++) { toReturn[i] = new GenerationCommand(commands[i]); } return(toReturn); }
public FloorGenerator(uint[] commands, int numberOfRooms, int seed, bool wallAllRooms) { roomsToGenerate = numberOfRooms; floorBeingBuilt = new Floor(); allCommands = GenerationCommand.ParseArray(commands); activeFloorSprawler = new FloorSprawler(); activeFloorSprawler.addRoom(floorBeingBuilt.StartRoom); commandCount = roomsBuilt = 0; RandomUtility.Initialize(seed); this.wallAllRooms = wallAllRooms; }
/// <summary> /// Updates the currentCommand instance variable that is used /// by most other methods. Also updates the commandCount instance /// variable that specifies what is the next command. If this /// count excedes the number of commands available, it will wrap /// to zero and start the cycle over again. /// </summary> private void UpdateCurrentCommand() { currentCommand = allCommands[commandCount]; currentCommand.ResetRoomsLeft(); commandCount = (commandCount + 1) % allCommands.Length; }