mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-03-25 03:04:29 -05:00
-Simplified and re calibrated ground check -Ground Check now functions well, test with inclines -Temporarily commented out player inventory lines that produced errors -Commented out debug statements
50 lines
1.1 KiB
C#
50 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlayerInventory : MonoBehaviour
|
|
{
|
|
//List of items
|
|
[SerializeField] List<Item> items;
|
|
|
|
//Scripts
|
|
public PlayerStats pStats;
|
|
public InventoryManager invMan;
|
|
|
|
public bool AddItem(Item item){
|
|
items.Add(item);
|
|
return true;
|
|
}
|
|
|
|
public bool AddSpecialItem<T>(T itemCandidate) { // Unless we don't want the four special items to be handled by inventory/inventory manager?
|
|
if (itemCandidate is Item) {
|
|
items.Add(itemCandidate as Item);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
public bool RemoveItem(Item item){
|
|
if(items.Remove(item)){
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void Awake(){
|
|
pStats = GetComponent<PlayerStats>();
|
|
invMan = GetComponent<InventoryManager>();//////UPDATE WHEN THIS IS NO LONGER ATTACHED TO THE PLAYER
|
|
}
|
|
|
|
void Start(){
|
|
//AddItem(invMan.ItemList[0]);
|
|
// AddItem(invMan.ItemList[1]);
|
|
foreach (Item item in items){
|
|
Debug.Log(item.name);
|
|
item.Equip(pStats);
|
|
}
|
|
}
|
|
|
|
|
|
}
|