/// <summary> /// Initializes a new instance of the <see cref="LevelBuilder" /> class. /// </summary> /// <param name="prefabService">The prefab service.</param> /// <param name="encounterService">The encounter service.</param> /// <param name="randomization">The randomization</param> public LevelBuilder( PrefabService prefabService, EncountersService encounterService, IRandomization randomization) { PlayerStart = new Pos2D(0, 0); _prefabService = prefabService; _encountersService = encounterService; _randomization = randomization; _cells = new Dictionary <Pos2D, GameCell>(); _cellRoomId = new Dictionary <Pos2D, Guid>(); _roomPrefabs = new Dictionary <Guid, PrefabData>(); _roomInstructions = new Dictionary <Guid, LevelAssemblyInstruction>(); _terrainObjects = new Dictionary <char, GameObjectType>(); PopulateObjectDictionary(); }
private void AddCoresToPrefab(IEnumerable <GameCell> cells, PrefabData prefab) { int numCores = _randomization.GetInt(prefab.MinCores, prefab.MaxCores); if (numCores > 0) { var elements = new List <EncounterElement>(numCores); for (int i = 0; i < numCores; i++) { elements.Add(new EncounterElement { ObjectType = GameObjectType.Core, ObjectId = Actors.Core }); } EncountersService.AddEncounterElementsToCells(elements, cells, _randomization); } }
/// <summary> /// Constructor. /// </summary> public EncounterController(EncountersService encountersService, ILogger <EncounterController> logger) : base(logger) { EncountersService = encountersService; }
/// <summary> /// Initializes a new instance of the <see cref="LevelGenerationService" /> class. /// </summary> /// <param name="prefabService">The prefab service.</param> /// <param name="encounterService">The encounter service.</param> public LevelGenerationService(PrefabService prefabService, EncountersService encounterService, IRandomization randomization) { _prefabService = prefabService; _encounterService = encounterService; _randomization = randomization; }