Advertisement
Guest User

Untitled

a guest
May 29th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class GrantPotion : MonoBehaviour {
  5.  
  6.  
  7.     public string potionName;
  8.     public int slot;
  9.  
  10.     void OnClick()
  11.     {
  12.  
  13.         EquipmentManager manager = GameObject.Find("Singletons").GetComponent<EquipmentManager>();
  14.  
  15.         InventoryManager.itemStruct potion = InventoryManager.Instance.findItem(potionName);
  16.  
  17.         EquipmentManager.equippedStruct newPotion = new EquipmentManager.equippedStruct
  18.         {
  19.             name = potion.name,
  20.             prefab = potion.prefab,
  21.             displayName = potion.displayName,
  22.             description = potion.description,
  23.             flavor = potion.flavor,
  24.             numberEquipped = 1
  25.         };
  26.  
  27.         if (manager.equippedPotions[slot].numberEquipped == null || manager.equippedPotions[slot].numberEquipped < 1)
  28.         {
  29.             manager.equippedPotions[slot] = newPotion;
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement