Пример #1
0
 public DungeonBuilder(IDungeonFactory iDungeonFactory)
 {
     _dungeonFactory        = iDungeonFactory;
     _dungeon               = iDungeonFactory.Create();
     _randomNumberGenerator = new Random();
 }
Пример #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="id">
        /// The ID of the location.
        /// </param>
        /// <param name="name">
        /// A string representing the name of the dungeon.
        /// </param>
        /// <param name="mapLocations">
        /// A list of map locations.
        /// </param>
        /// <param name="map">
        /// A 32-bit signed integer representing the number of maps in the dungeon.
        /// </param>
        /// <param name="compass">
        /// A 32-bit signed integer representing the number of compasses in the dungeon.
        /// </param>
        /// <param name="smallKeys">
        /// A 32-bit signed integer representing the number of small keys in the dungeon.
        /// </param>
        /// <param name="bigKey">
        /// A 32-bit signed integer representing the number of big keys in the dungeon.
        /// </param>
        /// <param name="mapItem">
        /// The map item.
        /// </param>
        /// <param name="compassItem">
        /// The compass item.
        /// </param>
        /// <param name="smallKeyItem">
        /// The small key item.
        /// </param>
        /// <param name="bigKeyItem">
        /// The big key item.
        /// </param>
        /// <param name="nodes">
        /// A list of dungeon node IDs within the dungeon.
        /// </param>
        /// <param name="items">
        /// A list of dungeon item IDs within the dungeon.
        /// </param>
        /// <param name="bosses">
        /// A list of dungeon item IDs for bosses within the dungeon.
        /// </param>
        /// <param name="smallKeyDoors">
        /// A list of small key door IDs within the dungeon.
        /// </param>
        /// <param name="bigKeyDoors">
        /// A list of big key door IDs within the dungeon.
        /// </param>
        /// <param name="entryNodes">
        /// A list of entry nodes for this dungeon.
        /// </param>
        public Dungeon(
            IItemDictionary items, IMode mode, IMutableDungeon.Factory mutableDungeonFactory,
            ILocationFactory locationFactory, IMapLocationFactory mapLocationFactory,
            ISectionFactory sectionFactory, IMarking.Factory markingFactory,
            ILocationNoteCollection notes, IDungeonFactory dungeonFactory,
            IKeyLayoutFactory keyDoorFactory, IDungeonState.Factory stateFactory, LocationID id)
            : base(locationFactory, mapLocationFactory, sectionFactory, markingFactory, notes, id)
        {
            _items = items;
            _mode  = mode;
            _mutableDungeonFactory = mutableDungeonFactory;
            _stateFactory          = stateFactory;

            Map       = dungeonFactory.GetDungeonMapCount(id);
            Compass   = dungeonFactory.GetDungeonCompassCount(id);
            SmallKeys = dungeonFactory.GetDungeonSmallKeyCount(id);
            BigKey    = dungeonFactory.GetDungeonBigKeyCount(id);

            MapItem      = dungeonFactory.GetDungeonMapItem(id);
            CompassItem  = dungeonFactory.GetDungeonCompassItem(id);
            SmallKeyItem = dungeonFactory.GetDungeonSmallKeyItem(id);
            BigKeyItem   = dungeonFactory.GetDungeonBigKeyItem(id);

            Nodes = dungeonFactory.GetDungeonNodes(id);

            DungeonItems = dungeonFactory.GetDungeonItems(id);
            Bosses       = dungeonFactory.GetDungeonBosses(id);

            SmallKeyDrops = dungeonFactory.GetDungeonSmallKeyDrops(id);
            BigKeyDrops   = dungeonFactory.GetDungeonBigKeyDrops(id);

            SmallKeyDoors = dungeonFactory.GetDungeonSmallKeyDoors(id);
            BigKeyDoors   = dungeonFactory.GetDungeonBigKeyDoors(id);

            KeyLayouts = keyDoorFactory.GetDungeonKeyLayouts(this);
            EntryNodes = dungeonFactory.GetDungeonEntryNodes(id);

            foreach (var section in Sections)
            {
                section.PropertyChanged += OnSectionChanged;
            }

            foreach (var node in EntryNodes)
            {
                node.ChangePropagated += OnNodeChangePropagated;
            }

            if (BigKeyItem != null)
            {
                BigKeyItem.PropertyChanged += OnItemChanged;
            }

            for (int i = 0; i < Environment.ProcessorCount; i++)
            {
                CreateDungeonData();
            }

            _mode.PropertyChanged += OnModeChanged;
            SubscribeToConnectionRequirements();
            UpdateSectionAccessibility();
        }
Пример #3
0
 /// <summary>
 /// АХТУНГ
 /// сюда не смотрите пропускайте
 /// !!!!
 /// </summary>
 /// <param name="factory">фабрика, описывающая создание частей подземелья</param>
 /// <param name="builder">функция, которая создает конфигурацию</param>
 public DungeonBuilder(
     IDungeonFactory factory,
     Func <DungeonConfigurationBuilder <EmptyDungeonConfiguration>, IDungeonConfiguration> builder)
     : this(factory, builder.Invoke(new DungeonConfigurationBuilder <EmptyDungeonConfiguration>()))
 {
 }
Пример #4
0
 /// Для своей работы использует фабрику и конфигурацию
 /// <summary>
 /// Конструктор строителя, принанимает два зависимости - фабрику благодаря,
 /// которой генерирует подземелье и конфигурациею, которая помогает фабрике с генерацией
 /// </summary>
 /// <param name="factory">фабрика</param>
 /// <param name="configuration">конфигурация</param>
 public DungeonBuilder(IDungeonFactory factory, IDungeonConfiguration configuration)
 {
     _dungeon       = new Dungeon();
     _configuration = configuration;
     _factory       = factory;
 }
Пример #5
0
 public GameEngine(ICombatEngine combatEngine, IRepository <Dungeon> dungeonRepository, IDungeonFactory dungeonFactory)
 {
     this.combatEngine      = combatEngine;
     this.dungeonRepository = dungeonRepository;
     this.dungeonFactory    = dungeonFactory;
 }