Typewriter
namespace Griff.Scenes;
public sealed class Typewriter : ComponentTypes out its entity’s Text a letter at a time, for dialogue and story cards. Whenever a script sets the text’s Value, the new text types out from the start. Runs on real time, so it works in a paused game.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”IsDone
Section titled “IsDone”public bool IsDone { get; }True once the whole text is showing (and always outside a running game).
PunctuationPause
Section titled “PunctuationPause”public float PunctuationPause { get; set; }Extra seconds to wait after a full stop, question or exclamation mark (half that after a comma).
public int Shown { get; }How many letters are showing.
public string? Sound { get; set; }A sound played as letters appear, e.g. “Sounds/blip.wav”. Empty is silent.
SoundEvery
Section titled “SoundEvery”public int SoundEvery { get; set; }Play Sound every this many letters.
public float Speed { get; set; }Letters per second; 0 shows everything at once.
Methods
Section titled “Methods”Restart
Section titled “Restart”public void Restart()Types the text out again from the start.
public void Skip()Shows the rest of the text straight away, e.g. when the player presses a key mid-line.
Visible
Section titled “Visible”public string? Visible(string? text)The part of text to draw now.
Events
Section titled “Events”Finished
Section titled “Finished”public event Action? FinishedRaised when the text has finished typing out.