mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
Created the Inventory Selection Scene
Added an ItemOption Prefab Created Player Prefab The player now will get their items in the inventory selection screen Only within this scene will items be able to be added and removed Updated player files to check for characterController being enabled This will make it easier to implement the dual RigidBody system
This commit is contained in:
@@ -9,39 +9,35 @@ public class PlayerInventory : MonoBehaviour
|
||||
|
||||
//Scripts
|
||||
public PlayerStats pStats;
|
||||
public InventoryManager invMan;
|
||||
|
||||
public bool AddItem(Item item){
|
||||
items.Add(item);
|
||||
return true;
|
||||
void Awake(){
|
||||
pStats = GetComponent<PlayerStats>();
|
||||
|
||||
}
|
||||
|
||||
public bool AddSpecialItem<T>(T itemCandidate) { // Unless we don't want the four special items to be handled by inventory/inventory manager?
|
||||
public void AddItem(Item item){
|
||||
if(!items.Contains(item)){
|
||||
Debug.Log("Item Added");
|
||||
items.Add(item);
|
||||
item.Equip(pStats);
|
||||
}
|
||||
else{
|
||||
Debug.Log("Item Removed");
|
||||
RemoveItem(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void 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){
|
||||
public void 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);
|
||||
item.Unequip(pStats);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user