Class LocomotionHandler
- Namespace
- Trailblazer.Navigation.Motor
- Assembly
- Trailblazer.dll
Manages locomotion states and behaviors for the NavMotor.
public class LocomotionHandler : IRecordable
- Inheritance
-
LocomotionHandler
- Implements
-
IRecordable
- Inherited Members
Remarks
This class coordinates multiple locomotion types, ensuring that movement states are properly managed.
Constructors
LocomotionHandler()
Initializes a new handler using the default locomotion profile.
public LocomotionHandler()
LocomotionHandler(LocomotionProfile)
Initializes a new handler from a locomotion profile.
public LocomotionHandler(LocomotionProfile profile)
Parameters
profileLocomotionProfile
Fields
IsInControl
Determines whether the scout has control over movement input.
public bool IsInControl
Field Value
Properties
Climb
Handles climb configuration and runtime attachment state.
public ClimbLocomotion? Climb { get; }
Property Value
Fall
Handles the scout’s falling behavior when downward momentum is detected.
public FallLocomotion Fall { get; }
Property Value
Remarks
This locomotion tracks fall distance, applies landing impact logic, and determines if a scout is free-falling.
Fly
Handles controlled flight while the scout is airborne.
public FlyLocomotion? Fly { get; }
Property Value
Forces
Holds the gravity and terminal velocity forces applied to a object, with support for per-instance overrides and global defaults.
public LocomotionForces Forces { get; }
Property Value
InstalledKinds
Gets the currently installed locomotion kinds.
public LocomotionKind InstalledKinds { get; }
Property Value
Jump
Controls the airborne state when a jump is executed successfully.
public JumpLocomotion? Jump { get; }
Property Value
Remarks
This locomotion governs jump height, cooldown timing, and jump force calculations.
Move
Handles general movement, including speed limits, acceleration, and velocity calculations.
public MoveLocomotion Move { get; }
Property Value
Platform
Manages movement when interacting with moving platforms or surfaces.
public PlatformLocomotion Platform { get; }
Property Value
Remarks
This locomotion maintains platform velocity tracking and movement transfer states.
Slide
Manages movement when sliding down steep surfaces.
public SlideLocomotion? Slide { get; }
Property Value
Remarks
This locomotion determines when the scout should slide and how much control it has over movement during the slide.
Water
Handles movement when the scout is in water, including active swimming, buoyancy, and water resistance.
public WaterLocomotion? Water { get; }
Property Value
Remarks
This locomotion tracks liquid-medium state such as swim speed, floating and sinking behavior, dive time, and breath management.
Methods
ApplyProfile(LocomotionProfile)
Replaces the installed locomotions with a new profile.
public void ApplyProfile(LocomotionProfile profile)
Parameters
profileLocomotionProfile
ClearAllTransientState()
Clears the transient state of all locomotion modules.
public void ClearAllTransientState()
Remarks
This method resets movement states without altering locomotion configurations, ensuring a clean reset of position, velocity, and state-based properties.
ClearTransientState<T>()
Clears the transient state for the locomotion component of the specified type, if it is enabled.
public void ClearTransientState<T>() where T : ILocomotion
Type Parameters
TThe type of locomotion component for which to clear transient state. Must implement the ILocomotion interface.
Remarks
This method has no effect if the specified locomotion component is not present or is not enabled.
GetLocomotions()
Gets and enumerates all locomotion instances in the handler.
public IEnumerable<ILocomotion> GetLocomotions()
Returns
Has(LocomotionKind)
Gets whether a built-in locomotion kind is installed.
public bool Has(LocomotionKind kind)
Parameters
kindLocomotionKind
Returns
Has<T>()
Gets whether a built-in locomotion type is installed.
public bool Has<T>() where T : class, ILocomotion
Returns
Type Parameters
T
Install<T>(T)
Installs or replaces a locomotion instance.
public void Install<T>(T locomotion) where T : class, ILocomotion
Parameters
locomotionT
Type Parameters
T
RecordData(IChronicler)
Records the current instance state to the provided chronicler.
public void RecordData(IChronicler chronicler)
Parameters
chroniclerIChroniclerThe active chronicler pass.
Remove<T>()
Removes an optional locomotion from the handler.
public bool Remove<T>() where T : class, ILocomotion
Returns
Type Parameters
T
Replace<T>(T)
Replaces a locomotion instance with a new one of the same type.
public void Replace<T>(T locomotion) where T : class, ILocomotion
Parameters
locomotionT
Type Parameters
T
Require<T>()
Retrieves an installed locomotion by type or throws if it is not installed.
public T Require<T>() where T : class, ILocomotion
Returns
- T
Type Parameters
T
SyncTransientState(LocomotionHandler)
Synchronizes locomotion states with another LocomotionHandler instance.
public void SyncTransientState(LocomotionHandler other)
Parameters
otherLocomotionHandlerThe locomotion handler instance to sync with.
Remarks
This ensures that all locomotion modules maintain consistent movement behavior when synchronizing states, which is useful for rollback systems or deterministic simulations.
ToProfile()
Creates a profile representing the handler's current locomotion composition.
public LocomotionProfile ToProfile()
Returns
TryGet<T>(out T?)
Attempts to retrieve an installed locomotion by type.
public bool TryGet<T>(out T? locomotion) where T : class, ILocomotion
Parameters
locomotionT
Returns
Type Parameters
T