PauseGroup
namespace Griff.Scenes;
public sealed class PauseGroup : ComponentMakes 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.
Properties
Section titled “Properties”PauseMessage
Section titled “PauseMessage”public string? PauseMessage { get; set; }A message sent with Game.Send as it pauses, e.g. “MinigamePaused”.
Paused
Section titled “Paused”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.
ResumeMessage
Section titled “ResumeMessage”public string? ResumeMessage { get; set; }A message sent with Game.Send as it starts again.
Methods
Section titled “Methods”public void Pause()Holds the group still, from the start of the next step.
Resume
Section titled “Resume”public void Resume()Starts the group again, from the start of the next step.
Toggle
Section titled “Toggle”public void Toggle()Pauses the group if it’s running, and starts it again if it’s paused.
Events
Section titled “Events”Resumed
Section titled “Resumed”public event Action<PauseGroup>? ResumedRaised as the group starts again.
WasPaused
Section titled “WasPaused”public event Action<PauseGroup>? WasPausedRaised as the group pauses (at the start of the next step after Paused is set).