Skip to content

OutputReader

namespace Griff.Scenes;
public sealed class OutputReader

Reads one output (see OutputAttribute) for a component that shows or carries it (a counter, a bar, a text, a wire), finding it by the names in that component’s fields once and again only when they change or what it found leaves: reading it every step allocates nothing.

The entity is the one the track field names (one inside the reader’s own entity first, otherwise the scene’s, a network game’s own player’s first; “*” is the first in the scene with the output), or without a name the reader’s own entity, or the nearest it’s inside, with that output.

public Component? Component { get; }

The component it reads, once found.

public float Number { get; }

What the output gives now, as a number (true is 1); 0 before it’s found or can be read.

public float OutOf { get; }

What the output is out of now (see OutOf); 0 for nothing.

public ComponentOutput? Output { get; }

The output it reads, once found.

public string? Text { get; }

What the output gives now, for one that gives a name; null for a number, or before it’s found.

public bool Find(Entity owner, string? track, string? output)

Finds the output output names on the entity track names (or owner’s own), unless it already has; true once it has one to read. A script’s isn’t read until it has started (see CanRead): false till then, as though it weren’t there yet.

public const string AnyEntity

The track that means any entity of the scene with the output, the first there is.