Skip to content

GameSetup

namespace Griff.Runtime;
public sealed class GameSetup

A game being made, as each GameModule sees it in AddTo: where it adds its systems, their steps and its network commands.

public Game Game { get; }

The game being made.

public T AddSystem<T>(T system)

Runs system for the whole game as one of Griff’s own: it can’t be removed, it forgets what it kept of a scene in its SceneChanged and draws in its Draw. Its work each frame is done by the steps the module adds for it (StepAfter, StepBefore), not its Update.

public void OnDialogueTags<T>(Action<Dialogue, string, string> run)

Does the dialogue tags of T (the words its DialogueTagsAttribute lists, written once, there) as the line they’re on is said: run is called with the dialogue, the word and what follows the word in the brackets (“Ava left happy” for “[show Ava left happy]”). A dialogue is said on the machine of the player reading it.

public void OnHostCommand(string name, Action<object> run)

Something the host of a network game can tell one player’s machine (what its run of that player’s tools wants shown there), by a name unique to the module: run is called on that machine with what the host sent. The host sends it with Game.Network.SendCommandTo.

public void OnNetCommand(string name, Action<NetPlayer, object> run)

Something players’ machines in a network game can ask the host to do, by a name unique to the module (e.g. “griff.rts”): run is called on the host with the player who asked and what they sent with it.

public StepId StepAfter(StepId after, string name, GameSystem system, Action run)

Adds a step called name to the frame, run as part of system, just after the step after (one of Griff’s, from Steps, or one this or another module added before) and after the steps added there before it, in that step’s phase. Returns the step’s id, for another step to follow it.

public StepId StepBefore(StepId before, string name, GameSystem system, Action run)

Adds a step called name to the frame, run as part of system, just before the step before and after the steps added before it there, in that step’s phase. Returns the step’s id, for another step to go next to it.