/// Adding in any item taken in to the list if not over Capicity public void AddToStash(Item item) { if (Inventory.Count >= ListCapicty) { return; } Inventory.Add(item); BackPackChange.Invoke(this); AddInfo(item); }
// New ups the list and adds the backpackconfig back public void RemoveAllFromStash() { if (Inventory == null) { return; } BackPackChange.Invoke(this); Inventory = new List <Item>(); foreach (var i in BackPackConfig.Items) { var startItems = Instantiate(i); AddToStash(startItems); } }
// Add item at given index //public void AddToStashAtIndex(Item item, int choosenIndexAt) //{ // if (Inventory.Count >= ListCapicty) return; // if (choosenIndexAt > ListCapicty || choosenIndexAt < 0) return; // Inventory.Insert(choosenIndexAt, item); // AddInfo(item); //} /// If the list contains the item remove it from the list public void RemoveFromStash(Item item) { if (Inventory == null) { return; } if (!Inventory.Contains(item)) { return; } Inventory.Remove(item); BackPackChange.Invoke(this); Debug.Log("Removed: " + item.GetType().ToString() + " " + _idcount); }