mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-03-22 09:44:15 -05:00
Player Inventory takes scriptable objects Items defines a scriptable object that modifies stats
31 lines
580 B
C#
31 lines
580 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlayerInventory : MonoBehaviour
|
|
{
|
|
[SerializeField] List<Item> items;
|
|
public PlayerStats pStats;
|
|
|
|
public bool AddItem(Item item){
|
|
items.Add(item);
|
|
return true;
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
|
|
}
|