Skip to content

ComponentAction

namespace Griff.Scenes;
public sealed class ComponentAction

One thing a component does that anything can set off (see ActionAttribute): its name, what it’s done with, and the call itself, which allocates nothing.

public Type ComponentType { get; }

The component type it belongs to.

public object? DefaultValue { get; }

What it’s done with when nothing says: the method’s default for the value if it has one, otherwise 1 for a number, true, or nothing for a name.

public string DisplayName { get; }

What it’s called with spaces between the words, e.g. “End Turn”.

public IReadOnlyList<string> FormerNames { get; }

Names it had before (FormerNameAttribute): what still names it.

public MethodInfo Method { get; }

The method it calls.

public string Name { get; }

What it’s called, without spaces, e.g. “EndTurn”.

public string QualifiedName { get; }

“Health.Damage”: the component’s name and the action’s, which names it even on an entity where two components have one called the same.

public bool TakesGame { get; }

True if it needs a service of the game it runs in (it’s set off only while one runs).

public string? ValueKind { get; }

“a number”, “a whole number”, “true or false” or “a name”; null for one that takes no value.

public string? ValueName { get; }

What its value is, from the method’s parameter, e.g. “amount” or “flag”; null for one that takes none.

public NamesAttribute? ValueNames { get; }

For an action done with a name: what the name names, when its parameter is marked NamesAttribute (a trigger’s Set Flag a flag, its Load Scene a scene), so a trigger’s or button’s With picks from those; null otherwise.

public Type? ValueType { get; }

The kind of value it’s done with: Single, Int32, Boolean or String; null for one that takes none.

public bool IsCalled(ReadOnlySpan<char> name)

True if name names it: its name or a former one (FormerNames), whatever the capitals and spaces (“end turn” is EndTurn), or with its component’s in front (“Health.Damage”).

public static bool SameWords(ReadOnlySpan<char> a, ReadOnlySpan<char> b)

True if two names are the same, whatever their capitals and spaces.

public static string Spaced(string name)

A name written as words, the way the editor shows it: “EndTurn” as “End Turn”.

public override string ToString()