Skip to main content

GuidedMovement

A class in Root.Township, the global namespace.

Moves this object along an IPositionRotationPath on the same object from a progress value, applied in fixed update by default.

Constructors​

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

Fields​

9 private and internal fields
MemberWhat it is
private Transform cachedTransformThis object's transform.
private bool hasChangedTrue when a new sample is waiting to be applied.
private bool isFixedUpdateApply positions in fixed update. Can only be set in edit mode.
private bool isNormalizedPassed to the path's GetPosition; true means the progress value is normalized (probably 0 to 1).
private static Logger loggerNLog logger for this class.
private IPositionRotationPath pathThe path followed.
private Vector3 positionLast sampled position.
private Quaternion rotationLast sampled rotation.
private IUnityUpdateMethod updateRegistered fixed update method.

Methods​

MemberWhat it is
void ResetPosition(Transform transform)Does nothing: it only reassigns its own parameter.
void SetProgress(float value)Samples the path at a progress value; applies it now, or on the next fixed update if isFixedUpdate.
3 private and internal methods
MemberWhat it is
private void Awake()Finds the path, caches the transform and registers the fixed update when isFixedUpdate.
private void OnDestroy()Deregisters the update.
private void UpdatePosition()Fixed update: applies the last sampled position and rotation if it changed.