Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Method in
public void Start();Method in
public void Interrupt()Method in
public void Complete();Class in Effects
Inherits from System.Object
An object that can be used to signal to a coroutine that it should terminate early.
public class CoroutineInterruptTokenWhile coroutines can be stopped by calling UnityEngine.MonoBehaviour.StopCoroutine(System.Collections.IEnumerator) or UnityEngine.MonoBehaviour.StopAllCoroutines, this has the side effect of also stopping any coroutine that was waiting for the now-stopped coroutine to finish.
Instances of this class may be passed as a parameter to a coroutine that they can periodically poll to see if they should terminate earlier than planned.
To use this class, create an instance of it, and pass it as a parameter to your coroutine. In the coroutine, call to mark that the coroutine is running. During the coroutine's execution, periodically check the property to determine if the coroutine should exit. If it is true, the coroutine should exit (via the yield break statement.) At the normal exit of your coroutine, call the method to mark that the coroutine is no longer running. To make a coroutine stop, call the method.
You can also use the property to determine if the token is in a state in which it can stop (that is, a coroutine that's using it is currently running.)
Class in Yarn.Unity
Inherits from System.Object
Contains coroutine methods that apply visual effects. This class is used by LineView to handle animating the presentation of lines.
public static class EffectsAn object that can be used to signal to a coroutine that it should terminate early.
A coroutine that fades a UnityEngine.CanvasGroup object's opacity from from to to over the course of fadeTime seconds, and then invokes onComplete .
A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI object over time.
A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI object over time.
Method in Effects
A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI object over time.
public static IEnumerator PausableTypewriter(TextMeshProUGUI text, float lettersPerSecond, Action onCharacterTyped, Action onPauseStarted, Action onPauseEnded, Stack<(int position, float duration)> pausePositions, CoroutineInterruptToken stopToken = null)Essentially identical to Typewriter(TextMeshProUGUI,float,Action,CoroutineInterruptToken) but supports pausing the animation based on pausePositions values.
This method works by adjusting the value of the text parameter's TextMeshProUGUI.maxVisibleCharacters property. This means that word wrapping will not change half-way through the presentation of a word.
Due to an internal implementation detail of TextMeshProUGUI, this method will always take at least one frame to execute, regardless of the length of the text parameter's text.
Method in Effects
A coroutine that fades a UnityEngine.CanvasGroup object's opacity from from to to over the course of fadeTime seconds, and then invokes onComplete .
public static IEnumerator FadeAlpha(CanvasGroup canvasGroup, float from, float to, float fadeTime, CoroutineInterruptToken stopToken = null)TMPro.TextMeshProUGUI text
A TextMeshProUGUI object to reveal the text of
float lettersPerSecond
The number of letters that should be revealed per second.
float from
The opacity value to start fading from, ranging from 0 to 1.
float to
The opacity value to end fading at, ranging from 0 to 1.
stopToken
A that can be used to interrupt the coroutine.
UnityEngine.CanvasGroup canvasGroup
System.Action onCharacterTyped
An System.Action that should be called for each character that was revealed.
System.Action onPauseStarted
An System.Action that will be called when the typewriter effect is paused.
System.Action onPauseEnded
An System.Action that will be called when the typewriter effect is restarted.
System.Collections.Generic.Stack<(int position, float duration)> pausePositions
A stack of character position and pause duration tuples used to pause the effect. Generally created by GetPauseDurationsInsideLine(Markup.MarkupParseResult)
A CoroutineInterruptToken that can be used to interrupt the coroutine.
float fadeTime
Method in Effects
A coroutine that gradually reveals the text in a TMPro.TextMeshProUGUI object over time.
public static IEnumerator Typewriter(TextMeshProUGUI text, float lettersPerSecond, Action onCharacterTyped, CoroutineInterruptToken stopToken = null)This method works by adjusting the value of the text parameter's TextMeshProUGUI.maxVisibleCharacters property. This means that word wrapping will not change half-way through the presentation of a word.
Due to an internal implementation detail of TextMeshProUGUI, this method will always take at least one frame to execute, regardless of the length of the text parameter's text.
TMPro.TextMeshProUGUI text
A TextMeshProUGUI object to reveal the text of.
float lettersPerSecond
The number of letters that should be revealed per second.
System.Action onCharacterTyped
An System.Action that should be called for each character that was revealed.
stopToken
A that can be used to interrupt the coroutine.
Property in
public bool WasInterrupted { get };Property in
public bool CanInterrupt { get };