first commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PuzzleUI : MonoBehaviour
|
||||
{
|
||||
public Text objectiveText;
|
||||
public Text solvedText;
|
||||
public Text debugText;
|
||||
public Text messageText;
|
||||
|
||||
private float messageTimer;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (messageTimer <= 0f || messageText == null || solvedText == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
messageTimer -= Time.deltaTime;
|
||||
|
||||
if (messageTimer <= 0f && !solvedText.gameObject.activeSelf)
|
||||
{
|
||||
messageText.text = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetObjective(string text)
|
||||
{
|
||||
if (objectiveText != null)
|
||||
{
|
||||
objectiveText.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSolvedVisible(bool visible)
|
||||
{
|
||||
if (solvedText != null)
|
||||
{
|
||||
solvedText.gameObject.SetActive(visible);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateDebug(bool keyPlaced, bool gemPlaced, bool solved)
|
||||
{
|
||||
if (debugText != null)
|
||||
{
|
||||
debugText.text = "Key placed: " + keyPlaced + "\n"
|
||||
+ "Gem placed: " + gemPlaced + "\n"
|
||||
+ "Puzzle solved: " + solved;
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowMessage(string text)
|
||||
{
|
||||
if (messageText != null)
|
||||
{
|
||||
messageText.text = text;
|
||||
messageTimer = 3f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user