Ejemplo n.º 1
0
        public override void PlayAction(AbstractCharacter character)
        {
            if (player.ConsumableSlot.GetComponent <AbstractItem>() != null)
            {
                playerConsumable = player.ConsumableSlot.GetComponent <AbstractItem>();
            }

            if (Inventory_System.InventorySystem.Instance.ConsumableSlot.GetComponent <AbstractItem>() != null)
            {
                inventoryConsumable = Inventory_System.InventorySystem.Instance.ConsumableSlot.GetComponent <AbstractItem>();
            }

            if (playerConsumable != null)
            {
                player.GetComponent <EquipmentComponent>().UnEquipComsumable();
                CopyComponent(playerConsumable, Inventory_System.InventorySystem.Instance.ConsumableSlot);
                playerConsumable.Destroythis();
            }
            if (inventoryConsumable != null)
            {
                player.GetComponent <EquipmentComponent>().EquipConsumable(inventoryConsumable as IConsumable);
                CopyComponent(inventoryConsumable, (player.ConsumableSlot));
                inventoryConsumable.Destroythis();
            }

            actionEnded?.Invoke(this, null);
        }
Ejemplo n.º 2
0
        public override void PlayAction(AbstractCharacter character)
        {
            if (player.WeaponSlot.GetComponent <AbstractItem>() != null)
            {
                playersweapon = player.WeaponSlot.GetComponent <AbstractItem>();
            }

            if (Inventory_System.InventorySystem.Instance.WeaponSlot.GetComponent <AbstractItem>() != null)
            {
                inventoryweapon = Inventory_System.InventorySystem.Instance.WeaponSlot.GetComponent <AbstractItem>();
            }

            if (playersweapon != null)
            {
                player.GetComponent <EquipmentComponent>().UnEquipWeapon();
                CopyComponent(playersweapon, Inventory_System.InventorySystem.Instance.WeaponSlot);
                playersweapon.Destroythis();
            }
            if (inventoryweapon != null)
            {
                player.GetComponent <EquipmentComponent>().EquipWeapon(inventoryweapon as IWeapon);
                CopyComponent(inventoryweapon, (player.WeaponSlot));
                inventoryweapon.Destroythis();
            }

            actionEnded?.Invoke(this, null);
        }
Ejemplo n.º 3
0
 public override void PlayAction(AbstractCharacter player)
 {
     if (item is IWeapon)
     {
         if (((Player)player).GetComponent <EquipmentComponent>().EquipWeapon(item as IWeapon))
         {
             CopyComponent(item, ((Player)player).WeaponSlot);
             item.Destroythis();
         }
     }
     else if (item is IConsumable)
     {
         if (((Player)player).GetComponent <EquipmentComponent>().EquipConsumable(item as IConsumable))
         {
             CopyComponent(item, ((Player)player).ConsumableSlot);
             item.Destroythis();
         }
     }
     actionEnded?.Invoke(this, null);
 }
 public override void PlayAction(AbstractCharacter character)
 {
     if (item is IWeapon)
     {
         CopyComponent(item, Inventory_System.InventorySystem.Instance.WeaponSlot);
     }
     else if (item is IConsumable)
     {
         CopyComponent(item, Inventory_System.InventorySystem.Instance.ConsumableSlot);
     }
     else
     {
         CopyComponent(item, Inventory_System.InventorySystem.Instance.SpellSlot);
     }
     item.Destroythis();
     actionEnded?.Invoke(this, null);
 }