45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using TMPro;
|
||
|
using System.Text;
|
||
|
|
||
|
public class HuDcko : MonoBehaviour
|
||
|
{
|
||
|
public int collectedcubes = 0;
|
||
|
public int collectedcubes_max = 0;
|
||
|
public bool ontop = false;
|
||
|
public string text = "";
|
||
|
public bool won = false;
|
||
|
public TextMeshProUGUI textmeshpro;
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
textmeshpro = GetComponent<TextMeshProUGUI>();
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
//prepare stringbuilder for textmeshpro
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.Append("Collected cubes: ");
|
||
|
sb.Append(collectedcubes);
|
||
|
sb.Append("/");
|
||
|
sb.Append(collectedcubes_max);
|
||
|
sb.Append("\n");
|
||
|
sb.Append("On top: ");
|
||
|
sb.Append(ontop);
|
||
|
sb.Append("\n");
|
||
|
string hax = sb.ToString();
|
||
|
if (won)
|
||
|
{
|
||
|
textmeshpro.text = "You won!";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
textmeshpro.text = hax;
|
||
|
}
|
||
|
}
|
||
|
}
|