Init
This commit is contained in:
44
Assets/Scripts/HuDcko.cs
Normal file
44
Assets/Scripts/HuDcko.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user