private void InventoryRightClick(ItemSlot itemSlot) { if (itemSlot.Item is EquippableItem) { Equip((EquippableItem)itemSlot.Item); } if (itemSlot.Item is EquippableItem) { Equip((EquippableItem)itemSlot.Item); } else if (itemSlot.Item is RestorableItem) { RestorableItem restorable = (RestorableItem)itemSlot.Item; restorable.Use(this); inventory.RemoveItem(restorable); restorable.Destroy(); if (restorable.IsConsumable) { inventory.RemoveItem(restorable); restorable.Destroy(); } } }
public void UseHotkeyItem(HotkeySlot hotkeySlot) { if (hotkeySlot.Item is RestorableItem) { RestorableItem restorable = (RestorableItem)hotkeySlot.Item; restorable.Use(this); hotkeyBar.RemoveItem(restorable); restorable.Destroy(); if (restorable.IsConsumable) { hotkeyBar.RemoveItem(restorable); restorable.Destroy(); } } if (hotkeySlot.Item is MagicalcardItem && isStartTimer != true) { //使用魔法書 MagicalcardItem magicalcard = (MagicalcardItem)hotkeySlot.Item; magicalcard.Use(this); isStartTimer = true; isHotkeySlot = hotkeySlot; isMagicCard = magicalcard; } else if ((hotkeySlot.Item is MagicalcardItem && isStartTimer != false)) //警告:冷卻時間無法持續使用 { FindObjectOfType <StatePanel>().SetSateText("<color=red>" + "目前無法使用該魔法" + "</color>"); //顯示StatePanel } }
public void UseHotkeyItem(HotkeySlot hotkeySlot) { if (hotkeySlot.Item is RestorableItem) { RestorableItem restorable = (RestorableItem)hotkeySlot.Item; restorable.Use(this); hotkeyBar.RemoveItem(restorable); restorable.Destroy(); if (restorable.IsConsumable) { hotkeyBar.RemoveItem(restorable); restorable.Destroy(); } } }