WalkArea
namespace Griff.Modules.Adventures;
public sealed class WalkArea : Component, IPointOutline, IDrawableWhere 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.
Properties
Section titled “Properties”Blocks
Section titled “Blocks”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.
FarScale
Section titled “FarScale”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.
GivenPoints
Section titled “GivenPoints”public IReadOnlyList<Vector2> GivenPoints { get; }NearScale
Section titled “NearScale”public float NearScale { get; set; }How big walkers are drawn at its bottom edge, nearest the player (1 as they are).
Points
Section titled “Points”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).
ScalesDepth
Section titled “ScalesDepth”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).
Methods
Section titled “Methods”Contains
Section titled “Contains”public bool Contains(Vector2 point)FromWorld
Section titled “FromWorld”public Vector2 FromWorld(Vector2 point)ScaleAt
Section titled “ScaleAt”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.
ScaleIn
Section titled “ScaleIn”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.
SetupNote
Section titled “SetupNote”public override string? SetupNote()A line for the Inspector when its points don’t make a shape.
ToWorld
Section titled “ToWorld”public Vector2 ToWorld(Vector2 point)public override bool Uses(string property)Fields
Section titled “Fields”DefaultPoints
Section titled “DefaultPoints”public const string DefaultPointsA new walk area’s points: a floor 8 wide and 3 deep.