Files
TutorialRTS/Assets/Scripts/GameUI.cs

56 lines
1.2 KiB
C#

using UnityEngine;
using TMPro;
public class GameUI : MonoBehaviour
{
public TextMeshProUGUI unitCountText;
public TextMeshProUGUI foodText;
public TextMeshProUGUI woodText;
public TextMeshProUGUI stoneText;
public static GameUI instance;
void Awake()
{
instance = this;
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void UpdateUnitCountText(int value)
{
unitCountText.text = value.ToString();
}
/*public void UpdateFoodText(int value)
{
foodText.text = value.ToString();
}*/
public void UpdateResourceText(int value, ResourceType type)
{
switch(type)
{
case ResourceType.Wood:
{
woodText.text = value.ToString();
break;
}
case ResourceType.Stone:
{
stoneText.text = value.ToString();
break;
}
case ResourceType.Food:
{
foodText.text = value.ToString();
break;
}
}
}
}