Skip to content

WalkArea

namespace Griff.Modules.Adventures;
public sealed class WalkArea : Component, IPointOutline, IDrawable

Where an adventure’s characters can walk (see Walker): a shape drawn round the floor of a room, its points dragged, added and taken off in the Scene view. A click on it walks there, round its corners; a click off it walks as close as it can. Tick Blocks for a hole in the floor where nobody walks (a table, a pond, a sleeping dog: inside a character, it moves with them), which walkers go round. Walk areas that overlap join up. With FarScale and NearScale, walkers are drawn smaller towards its top, as if further away, and walk slower there to match. The Scene view draws its outline; the game doesn’t, unless it’s Shown.

This is a component: its saved properties are on its component page.

public bool Blocks { get; set; }

A hole where nobody walks, cut out of the walk areas it’s on: a table, a pond, a character standing in the way.

public float FarScale { get; set; }

How big walkers are drawn at its top edge (1 as they are, 0.6 for 60%), as if further away; they walk slower there to match. Between its bottom and top they shrink evenly.

public IReadOnlyList<Vector2> GivenPoints { get; }
public float NearScale { get; set; }

How big walkers are drawn at its bottom edge, nearest the player (1 as they are).

public string? Points { get; set; }

Its corners in order round it, as “x y” pairs separated by semicolons, in world units before the transform’s scale, round the entity: “-4 -1.5; 4 -1.5; 4 1.5; -4 1.5” is a floor 8 wide and 3 deep. They can go round either way, and the shape can be any shape with straight sides (an L, a ring of a room round a pillar is two areas or a hole).

public bool ScalesDepth { get; }

True if it scales the walkers on it: its FarScale or NearScale isn’t 1.

public bool Shown { get; set; }

Draws its outline while the game runs too, to see where walkers can go (the Scene view always does).

public bool Contains(Vector2 point)
public Vector2 FromWorld(Vector2 point)
public float ScaleAt(Vector2 point)

How big a walker is drawn at point in the world: its NearScale at the bottom of the area and its FarScale at the top, evenly between.

public static float ScaleIn(Scene scene, Vector2 point)

How big walkers are drawn at point in scene: by the first walk area that scales depth and has it inside (or, with none there, the first that scales depth at all); 1 without one.

public override string? SetupNote()

A line for the Inspector when its points don’t make a shape.

public Vector2 ToWorld(Vector2 point)
public override bool Uses(string property)
public const string DefaultPoints

A new walk area’s points: a floor 8 wide and 3 deep.