Skip to main content

PositionProvider

A class in Root.Township, Alta.Logic.

Server: outputs this object's position (world or local) through a position event once on spawn, and again whenever it moves if set to. Saves its two settings.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private Transform cachedTransformThis object's transform, cached on spawn.
private bool isLocalPositionSend the local position instead of the world position.
private bool isMovingKeep sending the position as the object moves.
private PositionHandler positionSetEvent the position is sent through.
private IUnityUpdateMethod updatePositionHandle for the per-frame UpdatePosition call.

Properties​

1 private and internal property
MemberWhat it is
private int IBuildRendererBakeable.SortingOrder { get; }Bake order; always 0.

Methods​

MemberWhat it is
override void InitializeAsServer(SpawnData spawnData)Server: caches the transform and runs Setup.
void Setup(bool isLocalPosition, bool isMoving)One overload sends the position now and starts watching for movement if isMoving; the other just sets isLocalPosition and isMoving.
5 private and internal methods
MemberWhat it is
private void IBuildRendererBakeable.Bake(bool isSaving)Empty build bake hook.
private void IBuildRendererBakeable.Clean()Empty build bake hook.
private void OnDestroy()Stops the per-frame position check.
private void Setup()One overload sends the position now and starts watching for movement if isMoving; the other just sets isLocalPosition and isMoving.
private void UpdatePosition()Each frame, sends the position again if the transform changed.