mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
Added Inventory
Player Inventory takes scriptable objects Items defines a scriptable object that modifies stats
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user