Example #1
0
        public void Remove(ClothingItem item)
        {
            Backpack.Remove(item);

            var slot = GetSlot(item);
            if (slot.Value == item)
                slot.Value = null;

            item.OnToggle -= Toggle;
        }
Example #2
0
 private EZData.VariableContext<ClothingItem> GetSlot(ClothingItem item)
 {
     switch(item.Slot)
     {
     case Slot.Shoulders: return ShouldersEzVariableContext;
     case Slot.Bracers: return BracersEzVariableContext;
     case Slot.Boots: return BootsEzVariableContext;
     }
     return null;
 }
Example #3
0
        public void Add(ClothingItem item)
        {
            item.OnToggle += Toggle;

            Backpack.Add(item);
        }
Example #4
0
        private void Toggle(ClothingItem item)
        {
            var slot = GetSlot(item); // find a slot corresponding to the item
            if (slot.Value == item) // if item is equipped
            {
                slot.Value = null; // remove it from slot
                Backpack.Add(item); // and put to backpack
            }
            else // otherwise if item is not equipped
            {
                if (slot.Value != null)
                    Backpack.Add(slot.Value); // clear the slot if it was used

                Backpack.Remove(item); // take item from backpack
                slot.Value = item; // and put to the slot
            }
        }
Example #5
0
        public void Add(ClothingItem item)
        {
            item.OnToggle += Toggle;

            Backpack.Add(item);
        }