Esempio n. 1
0
 /// <summary>
 /// Removes an item from the referenced inventory and instantiates the item in scene.
 /// </summary>
 /// <param name="item">Item to drop.</param>
 public void DropItem(Item_Base item)
 {
     if (inventory.RemoveItem(item))
     {
         GameObject spawn = Instantiate(item.Model);
         Vector3    pos   = transform.position + (transform.forward * transform.localScale.z) + (transform.forward * item.Model.transform.localScale.z);
         spawn.transform.position = pos;
         spawn.SetActive(true);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Adds an item to this inventory.
 /// </summary>
 /// <param name="item">Item to add.</param>
 public void AddItem(Item_Base item)
 {
     items.Add(item);
 }
Esempio n. 3
0
 /// <summary>
 /// Removes an item from this inventory.
 /// </summary>
 /// <param name="item">Item to remove.</param>
 public bool RemoveItem(Item_Base item)
 {
     return(items.Remove(item));
 }
Esempio n. 4
0
 /// <summary>
 /// Called once when this object is serialized.
 /// </summary>
 private void Awake()
 {
     runtimeItem = Instantiate(item);
     updateable  = runtimeItem as IUpdateable;
 }