/// <summary> /// Method that will remove the interactibles from the inventory /// </summary> /// <param name="interType"></param> private void RemoveFromInventory(InteractibleType interType) { Interactible inter = _inventory.Find(it => it.type == interType); if (inter != null) { _inventory.Remove(inter); } // Calls UpdateInventoryIcons UpdateInventoryIcons(); }
/// <summary> /// Bool that will check if the player has an interactible on the inventory /// </summary> /// <param name="pickable"></param> /// <returns></returns> private bool HasInInventory(InteractibleType pickable) { foreach (Interactible item in _inventory) { if (item.type == pickable) { return(true); } } return(false); }
/// <summary> /// Bool that will check if the player has an interactible on the inventory /// </summary> /// <param name="pickable"></param> /// <param name="nRequirements"></param> /// <returns></returns> public bool HasInInventory(InteractibleType pickable, int nRequirements) { if (_inventory.Count < nRequirements) { return(false); } int n = 0; for (int i = 0; i < _inventory.Count; i++) { if (_inventory[i].type == pickable) { n++; if (n >= nRequirements) { return(true); } } } return(false); }