Added Inventory

Player Inventory takes scriptable objects
Items defines a scriptable object that modifies stats
This commit is contained in:
Melbyj1125
2021-10-08 13:46:00 -05:00
parent c16f07986d
commit 3569ef0366
4 changed files with 41 additions and 55 deletions

View File

@@ -4,15 +4,27 @@ using UnityEngine;
public class PlayerInventory : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
[SerializeField] List<Item> items;
public PlayerStats pStats;
public bool AddItem(Item item){
items.Add(item);
return true;
}
// Update is called once per frame
void Update()
{
public bool RemoveItem(Item item){
if(items.Remove(item)){
return true;
}
return false;
}
void Awake(){
pStats = GetComponent<PlayerStats>();
foreach (Item item in items){
item.Equip(pStats);
}
}
}