Skip to main content

SmoothLocomotionModifier

An abstract class in Root.Township, the global namespace.

Base for components next to SmoothLocomotion that change the local player's smooth movement: friction, height, upward grip, or taking over movement entirely. Registered with SmoothLocomotion.InitializeModifier.

Constructors​

MemberWhat it is
protected SmoothLocomotionModifier()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected SmoothLocomotion locomotionThe SmoothLocomotion on the same object.

Properties​

MemberWhat it is
virtual bool CanOverrideMovement { get; }When true, InitializeModifier also hooks MovementOverride, IsOverridingMovement and IsBlockingTeleportation. False by default.

Methods​

MemberWhat it is
abstract void DrawGizmos(SmoothLocomotion locomotion)Editor: draws debug gizmos for the modifier.
abstract void GetFrictionMultiplier(ref float friction)Adjusts the friction value passed in by reference.
abstract void GetHeight(ref float height)Adjusts the player height value passed in by reference.
virtual void GetUpwardGrip(ref float upwardGrip)Adjusts the upward grip passed in by reference. Does nothing by default.
virtual void IsBlockingTeleportation(ref bool isBlocking)Sets the flag to block teleporting while the modifier is active. Only hooked when CanOverrideMovement is true.
virtual bool IsOverridingMovement()Returns true while the modifier is taking over movement. False by default.
abstract void LocomotionUpdate()Runs on every SmoothLocomotion fixed update while registered.
virtual bool MovementOverride()Runs the modifier's own movement. False by default.
protected virtual void Awake()Finds the SmoothLocomotion on the same object.
protected virtual void OnDisable()Removes the modifier from SmoothLocomotion. The base OnEnable does not add it back, so subclasses register themselves.
protected virtual void OnEnable()Empty in the base class.