public void UsePotion(SimonItemData aItem) { if (aItem as ConsumableItemData) { m_PlayerTurns = false; m_SafetyLoop = 0; ActivatedEnemyButton(false); m_AllyFighters[m_CurrentAlly].m_Position.SetActive(false); ConsumableItemData cons = (ConsumableItemData)aItem; CombatManager.Instance.UsePotion(m_CurrentAlly, cons.EffectAmount); } }
void useItem(InventoryItemButton slot) { if (slot.Item.Item == null) { return; } SelectedConsumable = (ConsumableItemData)slot.Item.Item; //make the player select a character _eventSystem.SetSelectedGameObject(Player1); }
public void UseConsumableOnCharacter(Character character, int slotIndex) { if (SelectedConsumable != null) { switch (SelectedConsumable.ConsumableType) { case ConsumableItemData.Type.eHEALTH: character.ChangeHealth((int)SelectedConsumable.EffectAmount); break; case ConsumableItemData.Type.eMANA: character.ChangeMana((int)SelectedConsumable.EffectAmount); break; case ConsumableItemData.Type.eSTRENGTH: break; case ConsumableItemData.Type.eCONSITUTION: break; case ConsumableItemData.Type.eDEXTERITY: break; default: throw new ArgumentOutOfRangeException(); } } //remove object Debug.Log("Using item " + SelectedConsumable.Name); _partyInventory.Inventory.RemoveItem(_slots[slotIndex].Item); if (_slots[slotIndex].Item.Amount == 0) { removeSlot(_slots[slotIndex]); sortSlots(); } SelectedConsumable = null; _selectingPlayer = false; _eventSystem.SetSelectedGameObject(null, null); _eventSystem.SetSelectedGameObject(FirstSelected); }