/// <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); } }
/// <summary> /// Adds an item to this inventory. /// </summary> /// <param name="item">Item to add.</param> public void AddItem(Item_Base item) { items.Add(item); }
/// <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)); }
/// <summary> /// Called once when this object is serialized. /// </summary> private void Awake() { runtimeItem = Instantiate(item); updateable = runtimeItem as IUpdateable; }