public override IEnumerator Process() { // TODO: kind of weird config = Config.Config; if (config.LevelGraph == null) { throw new ArgumentException("LevelGraph must not be null."); } if (config.LevelGraph.Rooms.Count == 0) { throw new ArgumentException("LevelGraph must contain at least one room."); } var levelDescription = new LevelDescription(); // Setup individual rooms foreach (var room in config.LevelGraph.Rooms) { levelDescription.AddRoom(room, GetRoomTemplates(room)); } var typeOfRooms = config.LevelGraph.Rooms.First().GetType(); // Add passages foreach (var connection in config.LevelGraph.Connections) { if (config.UseCorridors) { var corridorRoom = (Room)ScriptableObject.CreateInstance(typeOfRooms); corridorRoom.Name = "Corridor"; levelDescription.AddCorridorConnection(connection, GetRoomTemplates(config.LevelGraph.CorridorRoomTemplateSets, config.LevelGraph.CorridorIndividualRoomTemplates), corridorRoom); } else { levelDescription.AddConnection(connection); } } Payload.LevelDescription = levelDescription; yield return(null); }
public FixedLevelGraphInputTask(FixedLevelGraphConfig config) { this.config = config; }