コード例 #1
0
        private void RollStartEquipment(IInventoryModule inventory, HumanPerson person)
        {
            var headDropScheme = GetHeads();

            FillSlot(person, headDropScheme, HEAD_SLOT_INDEX);

            var armorDropScheme = GetArmors();

            FillSlot(person, armorDropScheme, BODY_SLOT_INDEX);

            var mainWeaponDropScheme = GetMainWeapons();

            FillSlot(person, mainWeaponDropScheme, MAIN_HAND_SLOT_INDEX);

            var offWeaponDropScheme = GetOffWeapons();

            FillSlot(person, offWeaponDropScheme, OFF_HAND_SLOT_INDEX);

            var startPropDropScheme = GetStartProps();
            var startProps          = _dropResolver.Resolve(new[] { startPropDropScheme });

            foreach (var prop in startProps)
            {
                AddPropToInventory(inventory, prop);
            }

            AddResource(inventory, "packed-food", 1);
            AddResource(inventory, "water-bottle", 1);
            AddResource(inventory, "med-kit", 1);
            AddEquipment(inventory, "pick-axe");
            AddEquipment(inventory, "shovel");
            AddEquipment(inventory, "shotgun");
            AddResource(inventory, "bullet-45", 100);
        }
コード例 #2
0
        protected void AddEquipment(IInventoryModule inventory, string sid)
        {
            var scheme = SchemeService.GetScheme <IPropScheme>(sid);
            var prop   = _propFactory.CreateEquipment(scheme);

            AddPropToInventory(inventory, prop);
        }
コード例 #3
0
        protected override void RollStartEquipment(IInventoryModule inventory, HumanPerson person)
        {
            var templates      = GetPersonTemplateByFraction(person.Fraction, SchemeService);
            var rolledTemplate = Dice.RollFromList(templates);

            person.PersonEquipmentTemplate = rolledTemplate.Name;

            var headDropScheme = rolledTemplate.HeadEquipments;

            FillSlot(person, headDropScheme, HeadSlotIndex);

            var armorDropScheme = rolledTemplate.BodyEquipments;

            FillSlot(person, armorDropScheme, BodySlotIndex);

            var mainWeaponDropScheme = rolledTemplate.MainHandEquipments;

            FillSlot(person, mainWeaponDropScheme, MainHandSlotIndex);

            var offWeaponDropScheme = rolledTemplate.OffHandEquipments;

            FillSlot(person, offWeaponDropScheme, OffHandSlotIndex);

            var startPropDropScheme = rolledTemplate.InventoryProps;
            var startProps          = DropResolver.Resolve(new[] { startPropDropScheme });

            foreach (var prop in startProps)
            {
                AddPropToInventory(inventory, prop);
            }

            AddDefaultProps(inventory);
        }
コード例 #4
0
        protected override void RollStartEquipment(IInventoryModule inventory, HumanPerson person)
        {
            var headDropScheme = GetHeads();

            FillSlot(person, headDropScheme, HeadSlotIndex);

            var armorDropScheme = GetArmors();

            FillSlot(person, armorDropScheme, BodySlotIndex);

            var mainWeaponDropScheme = GetMainWeapons();

            FillSlot(person, mainWeaponDropScheme, MainHandSlotIndex);

            var offWeaponDropScheme = GetOffWeapons();

            FillSlot(person, offWeaponDropScheme, OffHandSlotIndex);

            var startPropDropScheme = GetStartProps();
            var startProps          = DropResolver.Resolve(new[] { startPropDropScheme });

            foreach (var prop in startProps)
            {
                AddPropToInventory(inventory, prop);
            }

            AddDefaultProps(inventory);

            AddEquipment(inventory, "pick-axe");
            AddEquipment(inventory, "shovel");
            AddEquipment(inventory, "shotgun");
            AddResource(inventory, "bullet-45", 100);
        }
コード例 #5
0
 protected void AddDefaultProps(IInventoryModule inventory)
 {
     AddResource(inventory, "packed-food", 1);
     AddResource(inventory, "water-bottle", 1);
     AddResource(inventory, "med-kit", 1);
     AddEquipment(inventory, "med-mask");
     AddEquipment(inventory, "med-gloves");
 }
コード例 #6
0
 private void AddResource(IInventoryModule inventory, string resourceSid, int count)
 {
     try
     {
         var resourceScheme = _schemeService.GetScheme <IPropScheme>(resourceSid);
         var resource       = _propFactory.CreateResource(resourceScheme, count);
         inventory.Add(resource);
     }
     catch (KeyNotFoundException)
     {
         Debug.LogError($"Не найден объект {resourceSid}");
     }
 }
コード例 #7
0
ファイル: SectorVM.cs プロジェクト: leorik/Zilon_Roguelike
 private void AddEquipment(IInventoryModule inventory, string equipmentSid)
 {
     try
     {
         var equipmentScheme = _schemeService.GetScheme <IPropScheme>(equipmentSid);
         var resource        = _propFactory.CreateEquipment(equipmentScheme);
         inventory.Add(resource);
     }
     catch (KeyNotFoundException)
     {
         Debug.LogError($"Не найден объект {equipmentSid}");
     }
 }
コード例 #8
0
        protected void AddResource(IInventoryModule inventory, string resourceSid, int count)
        {
            if (inventory is null)
            {
                throw new ArgumentNullException(nameof(inventory));
            }

            try
            {
                var resourceScheme = SchemeService.GetScheme <IPropScheme>(resourceSid);
                var resource       = _propFactory.CreateResource(resourceScheme, count);
                inventory.Add(resource);
            }
            catch (KeyNotFoundException exception)
            {
                throw new CreatePersonException($"Не найден объект {resourceSid}", exception);
            }
        }
コード例 #9
0
 public InventoryService(IInventoryModule inventoryApi, IMemoryCache memoryCache)
 {
     _inventoryApi = inventoryApi;
     _memoryCache  = memoryCache;
 }
コード例 #10
0
 public InventoryService(IInventoryModule inventoryApi, IStorefrontMemoryCache memoryCache, IApiChangesWatcher apiChangesWatcher)
 {
     _inventoryApi      = inventoryApi;
     _memoryCache       = memoryCache;
     _apiChangesWatcher = apiChangesWatcher;
 }
コード例 #11
0
 protected abstract void RollStartEquipment(IInventoryModule inventory, HumanPerson person);
コード例 #12
0
 protected Character(string name, params IModule[] modules) : base(modules)
 {
     _inventory = GetOrAddModule(new Inventory()); //TODO: Broken because their could be different types if inventories.
     Name       = name;
 }