Goal
namespace Griff.Modules.Puzzles;
public sealed class Goal : ComponentA place to push a crate to, for Sokoban-style puzzles, with no code: it’s covered while a grid crate (a Pushable with a GridMovement) rests in its cell, and once every goal with the same AllCoveredMessage is covered, that message is sent: the puzzle solved. Put it on the floor under where the crates go; it needs no collider (a solid one would block them). A Counter counting its Goals Covered shows how many are covered.
A crate that starts on a goal covers it from the start, without its sound or messages. Only a crate that has finished gliding into the cell covers it.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”Accepts
Section titled “Accepts”public string? Accepts { get; set; }The kinds of crate that cover it (each a pushable’s Kind), separated by commas, e.g. “Red, Blue”. Empty takes any crate.
AllCoveredMessage
Section titled “AllCoveredMessage”public string? AllCoveredMessage { get; set; }A message sent once every goal with this same All Covered Message is covered, with this entity as its data: every crate home, the level solved. It’s sent again if they’re all covered again after one is uncovered.
CoverMessage
Section titled “CoverMessage”public string? CoverMessage { get; set; }A message sent with Game.Send when a crate covers it, with this entity as its data.
CoveredBy
Section titled “CoveredBy”public Entity? CoveredBy { get; }The crate resting on it, or null.
CoveredTint
Section titled “CoveredTint”public Color CoveredTint { get; set; }The color a crate turns while it rests on it, so the player sees it’s in place. Transparent leaves crates alone.
public int Goals { get; }How many goals the scene has.
GoalsCovered
Section titled “GoalsCovered”public int GoalsCovered { get; }How many goals in the scene are covered, this one too: all of them once every crate is home.
IsCovered
Section titled “IsCovered”public bool IsCovered { get; }True while a crate it accepts rests on it.
public string? Sound { get; set; }A sound played when a crate covers it, e.g. “Sounds/click.wav”.
UncoverMessage
Section titled “UncoverMessage”public string? UncoverMessage { get; set; }A message sent with Game.Send when its crate is pushed off it, with this entity as its data.
Methods
Section titled “Methods”AcceptsKind
Section titled “AcceptsKind”public bool AcceptsKind(string? kind)True if crates of kind kind (a pushable’s Kind) cover it.
Events
Section titled “Events”Covered
Section titled “Covered”public event Action<Entity>? CoveredRaised when a crate covers it, with the crate.
Uncovered
Section titled “Uncovered”public event Action<Entity>? UncoveredRaised when its crate is pushed off it, with the crate.