Minigame
namespace Griff.Scenes;
public sealed class Minigame : ComponentPlays another scene on top of this one as a minigame, with no code: an arcade cabinet in a platformer that opens a match-3 board, a lock picked in a falling-blocks puzzle, a card duel in an adventure. Its Play action (from a Trigger, a button, a hotspot or a script) loads Scene into this scene, gives it the player’s input and the whole screen (its own camera, HUD and menus), and pauses everything else (or, without PauseBelow, lets the rest of the game run on out of sight). The minigame ends with a trigger in it doing Win Minigame or Lose Minigame (“when Won arrives, Win Minigame”); then it’s gone, the input goes back to what had it, and this entity sends WonMessage or LostMessage with the score, and shows how it went as outputs (Won, Score, Best…).
The minigame is part of the scene while it’s played (under an entity with a MinigameRoot, set beside the rest of the world so the two never touch), so a rewind goes back into it or to before it opened, and a saved game saves it. It can’t be played during a network game. A trigger’s Play Minigame plays one without this component, with its defaults.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”public int Best { get; set; }The best score it has been won with. Kept by the game.
public float Fade { get; set; }Seconds the screen fades out (and back in) going into the minigame and back. 0 cuts straight there.
LostMessage
Section titled “LostMessage”public string? LostMessage { get; set; }A message sent from this entity as the minigame is lost (or quit), with the score as its data.
PauseBelow
Section titled “PauseBelow”public bool PauseBelow { get; set; }Pauses everything else in this scene while the minigame is played. Untick it to keep the rest of the game running out of sight (a timer still counting, enemies still coming), though without the player’s input.
Playing
Section titled “Playing”public bool Playing { get; }True while its minigame is being played.
public int Plays { get; set; }How many times it has been played to the end. Kept by the game.
public string? Scene { get; set; }The scene played as the minigame, e.g. “Arcade”.
public int Score { get; set; }The score it was last won or lost with. Kept by the game.
public int Wins { get; set; }How many times it has been won. Kept by the game.
public bool Won { get; set; }True if the last time it was played it was won. Kept by the game.
WonMessage
Section titled “WonMessage”public string? WonMessage { get; set; }A message sent from this entity as the minigame is won, with the score as its data: a trigger opens a door on it.
Methods
Section titled “Methods”SetupNote
Section titled “SetupNote”public override string? SetupNote()public override bool Uses(string property)Events
Section titled “Events”public event Action<bool, int>? EndedRaised as its minigame ends: whether it was won, and the score.