mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-03-31 06:05:05 -05:00
-WallRunItem made for equipping/unequipping wall run -Added Method to PlayerInventory for trying to add special items as items -Added better method for checking if player isGrounded to PlayerMovement -Added a setup file for preconfiguring player loadouts -Added complex wallrun file as a work in progress to allow for robust polished wallrun mechanic
39 lines
848 B
C#
39 lines
848 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 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>();
|
|
foreach (Item item in items){
|
|
item.Equip(pStats);
|
|
}
|
|
}
|
|
|
|
|
|
}
|