Skip to content

Scope

namespace Griff.Scenes;
public struct Scope

The part of a scene something works on, from a property naming an entity (a TurnOrder’s Within): the whole scene when it names none; otherwise that entity and everything inside it (a group), and whatever stands in the part of the world it covers (an area: a Room’s, a tilemap’s, a collider’s; see AreaAttribute). A name nothing in the scene has covers nothing. Worked out once (see Of) and asked about as often as needed, allocating nothing.

public Box? Area { get; }

The part of the world it covers, if its entity covers one (see AreaAttribute).

public bool IsWholeScene { get; }

True if it covers the whole scene: nothing was named.

public Entity? Root { get; }

The entity it’s within: null for the whole scene (or for a name nothing has).

public static Scope WholeScene { get; }

The whole scene.

public bool Covers(Entity? entity)

True if it covers entity: the whole scene, or inside its entity, or standing in its area.

public bool Covers(Vector2 point)

True if it covers point in the world: the whole scene, or in its area.

public static Scope Of(Entity root)

The scope of everything inside root and standing in its area.

public static Scope Of(Entity? owner, string? within)

The scope a property of owner’s names with within: the entity called that (one inside the owner first, otherwise the first in its scene), or the whole scene for none.