Skip to content

Typewriter

namespace Griff.Scenes;
public sealed class Typewriter : Component

Types 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.

public bool IsDone { get; }

True once the whole text is showing (and always outside a running game).

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.

public int SoundEvery { get; set; }

Play Sound every this many letters.

public float Speed { get; set; }

Letters per second; 0 shows everything at once.

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.

public string? Visible(string? text)

The part of text to draw now.

public event Action? Finished

Raised when the text has finished typing out.