예제 #1
0
    protected void Start()
    {
        spriteRenderer = GetComponent <SpriteRenderer>();
        EquipmentManager.instance.onEquipmentChanged += Instance_onEquipmentChanged;
        Weapon = (Weapon)EquipmentManager.GetEquipment(EquipmentSlot.Weapon);
        spriteRenderer.sprite = Weapon.NonArmoredSprite;

        weaponAttackPrefab  = Weapon.Attack;
        currentWeaponAttack = Instantiate(weaponAttackPrefab, transform);
        attack = currentWeaponAttack.GetComponent <Spell>();
    }
예제 #2
0
        public void EquipmentManager_GetEquipment()
        {
            EquipmentAccessor.Arrange(x => x.GetEquipment(Arg.IsAny <long>()))
            .Returns(Task.FromResult(new Equipment()))
            .OccursOnce();

            var res = manager.GetEquipment(5).Result;

            Assert.IsNotNull(res);
            EquipmentAccessor.Assert();
        }
        public async Task <ActionResult> AddorEditEquipment(long?equipmentId)
        {
            var model     = new AddOrEditEquipmentViewModel();
            var equipment = new Equipment();

            if (equipmentId != null)
            {
                equipment = await EquipmentManager.GetEquipment((long)equipmentId);

                model.Title = "Edit Equipment";
            }
            else
            {
                equipment.DateAquired = DateTime.Now;
                model.Title           = "Add Equipment";
            }

            model.Equipment      = equipment;
            model.EquipmentTypes = await EquipmentTypeManager.GetEquipmentTypes();

            model.SelectTypes = model.EquipmentTypes.Select(x => new SelectListItem {
                Value    = x.EquipmentTypeId.ToString(),
                Text     = x.Name,
                Selected = model.Equipment.EquipmentTypeId == x.EquipmentTypeId ? true : false
            });
            model.SelectedID = equipment.EquipmentTypeId;
            return(View("AddOrEditEquipment", model));
        }
예제 #4
0
 void CmdUnEquipItem(int slot)
 {
     if (equipmentManager.GetEquipment((EquipmentSlot)slot) != null)
     {
         equipmentManager.UnEquip((EquipmentSlot)slot);
         RpcUnEquipItem(slot);
     }
 }
    public EquipmentData(EquipmentManager manager)
    {
        equipments     = new List <int>();
        equipmentStats = new List <float[]>();
        foreach (EquipmentSlot slot in Enum.GetValues(typeof(EquipmentSlot)))
        {
            Equipment equipment = manager.GetEquipment(slot);
            if (equipment)
            {
                equipments.Add(equipment.GetItemDictKey());

                float[] stats = new float[Enum.GetValues(typeof(StatType)).Length];
                foreach (StatType type in Enum.GetValues(typeof(StatType)))
                {
                    stats[(int)type] = equipment.GetStatModValue(type);
                }
                equipmentStats.Add(stats);
            }
        }
    }