28 lines
746 B
C#
28 lines
746 B
C#
using UnityEngine;
|
|
|
|
public class PlayerInventory : Inventory
|
|
{
|
|
public static PlayerInventory instance;
|
|
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
// We can update the UI here because this is the Player's inventory
|
|
HealthBarUI.instance.UpdateGold(Gold);
|
|
}
|
|
|
|
// 'override' modifies the base AddItem method to add UI updates
|
|
public override void AddItem(string itemName)
|
|
{
|
|
// This calls the base AddItem logic first
|
|
base.AddItem(itemName);
|
|
|
|
// Then, it adds the player-specific UI update
|
|
Debug.Log("Updating player UI for item: " + itemName);
|
|
// You would add your specific UI update logic here, e.g., UpdateInventoryUI();
|
|
}
|
|
} |