mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 18:04:27 -05:00
small changes to player and items for cleanup
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user