Permet d'utiliser TextMeshPro dans le code Déplacé les script liés à la gestion de ressources dans le répertoire Script/Resource
34 lines
831 B
C#
34 lines
831 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
/// <summary>
|
|
/// Gère l'affichage des resources
|
|
/// </summary>
|
|
public class ResourceText : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private TextMeshProUGUI _rockText;
|
|
[SerializeField]
|
|
private TextMeshProUGUI _woodText;
|
|
[SerializeField]
|
|
private TextMeshProUGUI _foodText;
|
|
|
|
private ResourceManager _resourceManager;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
_resourceManager = ResourceManager.Instance;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
_rockText.text = _resourceManager.RockAmount.ToString();
|
|
_woodText.text = _resourceManager.WoodAmount.ToString();
|
|
_foodText.text = _resourceManager.FoodAmount.ToString();
|
|
}
|
|
}
|