private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { potion.Drink(); Destroy(this.gameObject); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { Player player = other.GetComponent <Player>(); potion.Drink(player); Destroy(gameObject); other.GetComponent <Player>().SpeedBoostForSeconds(speedSeconds, speedBoost); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { Player player = other.GetComponent <Player>(); potion.Drink(player); Destroy(gameObject); other.GetComponent <Player>().BecomeInvulnerableForSeconds(invulnSeconds); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { Player player = other.GetComponent <Player>(); potion.Drink(player); Destroy(gameObject); player.HealPlayer(); } }
/// <summary> /// Drink Potion is a method that is specific to heros. I did not inherit it from Character. Therefore I don't need the override keyword. /// Also, I don't want to rewrite this method for every single class that inherits from hero, so I am making one to rule them all here. /// </summary> public void DrinkPotion(PotionName PotionName) { Potion p = Potions.Where(p => p.Name == PotionName).FirstOrDefault(); p.Drink(Name); // Potions give you a health boost. So make sure to increase your health bar! HealthBar += p.HealthBoostAmount; // Potions are a one time use, so remove it from your list of potions Potions.Remove(p); }
private void HotKeyAction(int ind) { int index = GetIndex(hotkeySlots[ind - 1]); if (allItems[index] == null) { return; } if (allItems[index] is Weapon || allItems[index] is Helmet || allItems[index] is Trinket) { EquipItem(index); return; } if (allItems[index] is Potion) { Potion temp = (Potion)allItems[index]; temp.Drink(); } }
private void OnTriggerEnter(Collider other) { potion.Drink(); Destroy(this.gameObject); }
private void OnTriggerEnter(Collider other) { potion.Drink(); Debug.Log("Healt Restored"); Destroy(gameObject); }
private void OnTriggerEnter(Collider other) { potion.Drink(); Debug.Log("Salud recuperada"); Destroy(gameObject); }
private void Update() { if (!isInitialised) { return; } if (Input.GetKeyDown(KeyCode.V)) { photonView.RPC("ResetAVR", RpcTarget.MasterClient); } if (Input.GetKeyDown(KeyCode.K)) { photonView.RPC("AddGold", RpcTarget.All, UnityEngine.Random.Range(500, 1000)); } if (Input.GetKeyDown(KeyCode.L)) { RemoveAllItems(); } if (Input.GetButtonDown("One")) { if (InventoryIsOpen()) { EquipToHotkey(1); } else { HotKeyAction(1); } } if (Input.GetButtonDown("Two")) { if (InventoryIsOpen()) { EquipToHotkey(2); } else { HotKeyAction(2); } } if (Input.GetButtonDown("Three")) { if (InventoryIsOpen()) { EquipToHotkey(3); } else { HotKeyAction(3); } } if (Input.GetButtonDown("Four")) { if (InventoryIsOpen()) { EquipToHotkey(4); } else { HotKeyAction(4); } } if (Input.GetButtonDown("Five")) { if (InventoryIsOpen()) { EquipToHotkey(5); } else { HotKeyAction(5); } } if (currentSlot != null) { int index = GetIndex(currentSlot); if (allItems[index] != null) { allItems[index].SendInfo(); } else { StatsInfo.instance.DisablePanel(); } } else { StatsInfo.instance.DisablePanel(); } if (currentSlot != null) { if (Input.GetButtonDown("Fire2")) { int index = GetIndex(currentSlot); OnRightClickInventorySlot(allItems[index]); if (ArmoryManager.instance.HasOpenUI()) { return; } if (allItems[index] is Potion) { Potion temp = (Potion)allItems[index]; temp.Drink(); return; } EquipItem(GetIndex(currentSlot)); CalculateArmor(); UpdateInventoryColor(); } } if (Input.GetButtonDown("Fire3")) { if (currentSlot != null) { int index = 0; for (int i = 0; i < allSlots.Count; i++) { if (currentSlot == allSlots[i]) { index = i; } } if (allItems[index] != null) { if (allSlots[index].slotType == InventorySlot.SlotType.weapon) { allSlots[index].EquipWeapon(null); CalculateArmor(); } if (allSlots[index].slotType == InventorySlot.SlotType.helmet) { allSlots[index].EquipHelmet(null); CalculateArmor(); } if (allSlots[index].slotType == InventorySlot.SlotType.trinket) { allSlots[index].EquipTrinket(null); } GameObject newObj = Database.hostInstance.allGameobjects[allItems[index].prefabIndex]; SaveItem(allItems[index], newObj.name, Player.localPlayer.transform.position); RemoveItem(index); drag = null; } } CalculateArmor(); UpdateInventoryColor(); } if (Input.GetButtonDown("Tab")) { OpenCloseInv(); } if (Input.GetKey(KeyCode.H)) { if (Input.GetKeyDown(KeyCode.B)) { if (LootRandomizer.instance != null) { for (int i = 0; i < 10; i++) { Item newItem = LootRandomizer.instance.DropLoot(100 + averageILevel, 3); if (newItem == null) { return; } AddItem(newItem); } } } else if (Input.GetKeyDown(KeyCode.N)) { if (LootRandomizer.instance != null) { Item newItem = LootRandomizer.instance.DropLoot(10 + averageILevel, 3); if (newItem != null) { AddItem(newItem); } } } } else if (Input.GetKeyDown(KeyCode.N)) { if (LootRandomizer.instance != null) { for (int i = 0; i < allSlots.Count; i++) { Item newItem = LootRandomizer.instance.DropLoot(averageILevel, 3); if (newItem != null) { AddItem(newItem); } } } } if (Input.GetKeyDown(KeyCode.M)) { CalculateArmor(); SetInfo(); } if (drag == null) { onMouse.enabled = false; } else { onMouse.enabled = true; onMouse.sprite = Database.hostInstance.allSprites[drag.spriteIndex]; onMouse.transform.position = Input.mousePosition; } }
public override void Execute() { base.Execute(); potion.Drink(owner); Successfull(); }