Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class GrantPotion : MonoBehaviour {
- public string potionName;
- public int slot;
- void OnClick()
- {
- EquipmentManager manager = GameObject.Find("Singletons").GetComponent<EquipmentManager>();
- InventoryManager.itemStruct potion = InventoryManager.Instance.findItem(potionName);
- EquipmentManager.equippedStruct newPotion = new EquipmentManager.equippedStruct
- {
- name = potion.name,
- prefab = potion.prefab,
- displayName = potion.displayName,
- description = potion.description,
- flavor = potion.flavor,
- numberEquipped = 1
- };
- if (manager.equippedPotions[slot].numberEquipped == null || manager.equippedPotions[slot].numberEquipped < 1)
- {
- manager.equippedPotions[slot] = newPotion;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement