Skip to content

Goal

namespace Griff.Modules.Puzzles;
public sealed class Goal : Component

A 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.

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.

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.

public string? CoverMessage { get; set; }

A message sent with Game.Send when a crate covers it, with this entity as its data.

public Entity? CoveredBy { get; }

The crate resting on it, or null.

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.

public int GoalsCovered { get; }

How many goals in the scene are covered, this one too: all of them once every crate is home.

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”.

public string? UncoverMessage { get; set; }

A message sent with Game.Send when its crate is pushed off it, with this entity as its data.

public bool AcceptsKind(string? kind)

True if crates of kind kind (a pushable’s Kind) cover it.

public event Action<Entity>? Covered

Raised when a crate covers it, with the crate.

public event Action<Entity>? Uncovered

Raised when its crate is pushed off it, with the crate.