using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class GoldManager : MonoBehaviour { public GameObject victoryPanel; // Assign in the Inspector public TMP_Text goldCountText; // Assign in the Inspector public TMP_Text victoryGoldCountText; // Assign in the Inspector private int currentGold = 0; private const int victoryGoldAmount = 100; private void Start() { UpdateGoldText(); victoryPanel.SetActive(false); // Hide the victory panel initially } public void UpdateCurrentGold() { currentGold += 1; UpdateGoldText(); if (currentGold >= victoryGoldAmount) { ShowVictoryPanel(); } } public void ResetGold() { currentGold = 0; UpdateGoldText(); victoryPanel.SetActive(false); // Hide the victory panel when gold is reset } private void UpdateGoldText() { goldCountText.text = currentGold.ToString("D3"); } private void ShowVictoryPanel() { victoryPanel.SetActive(true); // Show the victory panel victoryGoldCountText.text = currentGold.ToString("D3"); // Update the gold count text on the victory panel } }