mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 18:04:27 -05:00
Added Item Cost and Max Points
Added Glide Added Item adding verification
This commit is contained in:
@@ -4,6 +4,7 @@ using UnityEngine;
|
||||
|
||||
public class PlayerInventory : MonoBehaviour
|
||||
{
|
||||
|
||||
//List of items
|
||||
[SerializeField] List<Item> items;
|
||||
|
||||
@@ -12,15 +13,19 @@ public class PlayerInventory : MonoBehaviour
|
||||
|
||||
void Awake(){
|
||||
pStats = GetComponent<PlayerStats>();
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
|
||||
}
|
||||
|
||||
public void AddItem(Item item){
|
||||
if(!items.Contains(item)){
|
||||
public void AddItem(Item item, bool ableToAdd){
|
||||
if(!items.Contains(item) && ableToAdd){
|
||||
Debug.Log("Item Added");
|
||||
items.Add(item);
|
||||
item.Equip(pStats);
|
||||
}
|
||||
else if(!ableToAdd && !items.Contains(item)){
|
||||
Debug.Log("Item Cannot Be Added");
|
||||
}
|
||||
else{
|
||||
Debug.Log("Item Removed");
|
||||
RemoveItem(item);
|
||||
@@ -41,5 +46,9 @@ public class PlayerInventory : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public List<Item> GetItems(){
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user