Added Timer

New version featuring a timer
This commit is contained in:
Gerard Gascón 2021-06-11 19:34:49 +02:00 committed by GitHub
parent f7c4067db4
commit 750d7f6b88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 186 additions and 23 deletions

View file

@ -1,6 +1,6 @@
using UnityEngine;
[CreateAssetMenu(fileName = "New Character", menuName = "Tools/Character", order = 0)]
[CreateAssetMenu(fileName = "New Character", menuName = "Simple Tools/Character", order = 11)]
public class Dialogue : ScriptableObject{
public bool displayName;

View file

@ -8,12 +8,17 @@ namespace TMPro{
public class TMP_Animated : TextMeshProUGUI{
float speed;
float speed = 20;
public TextRevealEvent onTextReveal;
public DialogueEvent onDialogueFinish;
public void ReadText(string newText){
void Update(){
/*if(Application.isPlaying)
this.Animate();*/
}
public void ReadText(string newText){
text = string.Empty;
string[] subTexts = newText.Split('<', '>');
@ -27,7 +32,7 @@ namespace TMPro{
}
bool isCustomTag(string tag){
return tag.StartsWith("speed=") || tag.StartsWith("pause=");
return tag.StartsWith("speed=") || tag.StartsWith("pause=") || tag.StartsWith("wave") || tag.StartsWith("rainbow") || tag.StartsWith("shake");
}
text = displayText;
@ -45,7 +50,9 @@ namespace TMPro{
onTextReveal.Invoke(subTexts[subCounter][visibleCounter]);
visibleCounter++;
maxVisibleCharacters++;
yield return new WaitForSeconds(1f / speed);
//this.Animate();
yield return new WaitForSeconds(text[maxVisibleCharacters - 1] == ' ' ? 0 : (1f / speed));
}
visibleCounter = 0;
}