Skip to content

ISelectionRules

namespace Griff.Scenes;
public interface ISelectionRules

What a SelectionState asks of the game it selects in: what a click or a box picks, what a double-click picks, and what a Shift-click can add. A SelectionControls answers with the Selectables in view; the Strategy module’s Commander with its team’s units, buildings and resources.

public abstract bool CanAdd(Entity picked, IReadOnlyList<Entity> selected)

Whether a click with AddToSelection held adds picked to selected (or takes it out), rather than selecting it alone.

public abstract IEnumerable<Entity> InBox(Box box)

What a box dragged out over box picks.

public abstract bool Keeps(Entity entity)

Whether entity, selected, stays selected as a box adds to the selection, and goes into a control group kept.

public abstract Entity? PickAt(Vector2 point)

What a click at point (in the world) picks, or null for nothing.

public abstract IEnumerable<Entity>? SameKind(Entity picked)

What a double-click on picked picks (every one of its kind on screen), or null if a double-click on it is only a click.

public abstract void SelectionSet()

Called each time a click, a box or a control group sets the selection, even to what it was.

public abstract bool StillThere(Entity entity)

Whether a control group still has entity as it’s picked again: false once it’s gone.