Skip to content

PauseGroup

namespace Griff.Scenes;
public sealed class PauseGroup : Component

Makes its entity and everything inside it a group that can be paused on its own while the rest of the game runs on: a match-3 minigame on an arcade cabinet, one player’s half of a split screen, the world behind a shop. While it’s Paused, nothing in the group moves, falls, animates, emits, counts down, spawns, shoots, runs its scripts or takes the player’s input; it’s still drawn, and still solid to what’s outside it. Its Pause, Resume and Toggle actions let a Trigger, a wire or a script do it with no code, and a switch or a wire into its Power runs it while on and pauses it while off. A panel or a dialogue can pause a group too, while it’s open or being said (see Pauses and Pauses).

Paused groups are worked out on every step from what’s paused then, so rewinding puts them back as they were. In a network game the host runs it, as it runs the rest of the game.

This is a component: its saved properties are on its component page.

public string? PauseMessage { get; set; }

A message sent with Game.Send as it pauses, e.g. “MinigamePaused”.

public bool Paused { get; set; }

Whether the group is held still now. Tick it to start the scene with it paused; scripts and the Pause and Resume actions set it. A switch powering it unticks it while on, and ticks it while off.

public string? ResumeMessage { get; set; }

A message sent with Game.Send as it starts again.

public void Pause()

Holds the group still, from the start of the next step.

public void Resume()

Starts the group again, from the start of the next step.

public void Toggle()

Pauses the group if it’s running, and starts it again if it’s paused.

public event Action<PauseGroup>? Resumed

Raised as the group starts again.

public event Action<PauseGroup>? WasPaused

Raised as the group pauses (at the start of the next step after Paused is set).