Skip to content

Mover

namespace Griff.Scenes;
public sealed class Mover : Component

Moves its entity along a path with no code: moving platforms, lifts, saws, patrolling hazards. Points are offsets from where it’s placed, e.g. “4 0” (four units right and back) or “4 0; 4 3” (right, then up). Bodies standing on it ride along. The Scene view draws the path; select it to drag its points. With Beats set, it steps from point to point on the beat of a BeatClock.

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

public int BeatOffset { get; set; }

Steps this many beats later: with two platforms on every 2 beats, one 1 beat later, they take turns.

public int Beats { get; set; }

Steps to the music of a BeatClock: sets off for its next point on every this many beats, getting there at Speed (or faster, to be there by the next step), and waits there for the step after. 0 goes by seconds.

public string? Clock { get; set; }

The entity whose BeatClock it steps to. Empty follows the first in the scene.

public bool IsFinished { get; }

True once a Once mover has reached its last point.

public MoverMode Mode { get; set; }

What it does at the last point: go back the same way, go round again, or stop.

public IReadOnlyList<Vector2> Path { get; }

The path, starting with (0, 0), in the parent’s space relative to where it was placed.

public string? Points { get; set; }

Where to go, as offsets from where it’s placed: “x y” pairs separated by semicolons, e.g. “0 3” for a lift or “4 0; 4 3; 0 3” for a square. The start (0 0) is always the first point.

public bool Running { get; set; }

Untick it to stop it where it is; a Once mover slides back to its start instead, so a gate closes again. Switches tick and untick it.

public bool Smooth { get; set; }

Ease in and out of each point instead of starting and stopping dead.

public float Speed { get; set; }

World units per second.

public bool StepByStep { get; set; }

Moves only when it’s stepped, point by point: by its Step action (a trigger, a wire) or on its Beats. Its first Step ticks it.

public float Time { get; set; }

Seconds into its trip. Set it in the Inspector to start part of the way round, so a row of platforms don’t all move together.

public float TripSeconds { get; }

Seconds for one full trip, waits included, before it repeats.

public float Wait { get; set; }

Seconds to wait at each point. Stepping to the Beats, it waits for the next step instead.

public Vector2 OffsetAt(float time)

Where on its path it is time seconds into its trip, as an offset from where it started.

public static IReadOnlyList<Vector2> ParsePoints(string? text)

Reads “x y; x y” (commas work between the numbers too). Anything that isn’t a pair of numbers is skipped.

public void Step()

Sets off for its next point, getting there at its Speed, and waits there for the next step: a lift called by a button, a platform that moves on each match. From then on it moves only when stepped (see StepByStep).