small changes to player and items for cleanup

This commit is contained in:
Melbyj1125
2021-11-17 12:21:15 -06:00
parent 2fe2fa5764
commit e2a1a9150c
20 changed files with 135 additions and 46 deletions

View File

@@ -17,28 +17,35 @@ public class PlayerInventory : MonoBehaviour
}
//Add item to player Inventory
public void AddItem(Item item, bool ableToAdd){
if(!items.Contains(item) && ableToAdd){
Debug.Log("Item Added");
//Add item to player inventroy list
items.Add(item);
//Equip item
item.Equip(pStats, this.gameObject);
}
else if(!ableToAdd && !items.Contains(item)){
//Item cannot be added
Debug.Log("Item Cannot Be Added");
}
else{
//If player already has the item it removes it
Debug.Log("Item Removed");
RemoveItem(item);
}
}
//Remove Item player inv
public void RemoveItem(Item item){
if(items.Remove(item)){
item.Unequip(pStats, this.gameObject);
}
}
//GetItems
public List<Item> GetItems(){
return items;
}