Completed course 2 adn 3, working on 4
This commit is contained in:
55
Assets/Scripts/GameUI.cs
Normal file
55
Assets/Scripts/GameUI.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user