Working on entrance and building out first level
This commit is contained in:
34
Assets/Scripts/Log.cs
Normal file
34
Assets/Scripts/Log.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
|
||||
public class Log : MonoBehaviour
|
||||
{
|
||||
TextMeshProUGUI tmpText;
|
||||
void Awake()
|
||||
{
|
||||
tmpText = GetComponent<TextMeshProUGUI>();
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
tmpText.text = "";
|
||||
tmpText.enabled = false;
|
||||
}
|
||||
public void WriteOutLog(string text, float letterDelay = 0.05f)
|
||||
{
|
||||
StartCoroutine(WriteLog(text, letterDelay));
|
||||
}
|
||||
|
||||
IEnumerator WriteLog(string text, float letterDelay)
|
||||
{
|
||||
tmpText.text = "";
|
||||
tmpText.enabled = true;
|
||||
|
||||
foreach (char letter in text)
|
||||
{
|
||||
tmpText.text += letter;
|
||||
yield return new WaitForSeconds(letterDelay);
|
||||
}
|
||||
tmpText.enabled = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user