Skip to main content

MovingPlatform

A class in Root.Township, the global namespace.

Trigger volume that carries players and loose pickups with a moving entity. The server tracks pickups and rigidbodies; clients track the local player.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private Dictionary<Pickup, Timeline.IEntry> delaysPending timed adds for pickups that just entered.
private bool isClientTrue on clients or local test.
private bool isServerTrue on the server.
private float pickupAddDelaySeconds a loose pickup must stay inside before it rides the platform.

Properties​

MemberWhat it is
NetworkEntity Entity { get; private set; }The platform's network entity.
override bool IsCheckingForPickup { get; }True on the server.
override bool IsCheckingForPlayer { get; }True on clients (and local test).
override bool IsCheckingForRigidbody { get; }True on the server.
IMovementContext MovementContext { get; private set; }Movement context that moves riders with the platform.

Methods​

MemberWhat it is
protected override void PickupEntered(Pickup pickup)Adds the pickup, after pickupAddDelay if it is loose.
protected override void PickupLeft(Pickup pickup)Cancels a pending add, or unhooks and removes the platform from the pickup.
protected override void PlayerEntered(SmoothLocomotionPlayerController player)Client: gives the local player the movement context and parents them to the platform.
protected override void PlayerLeft(SmoothLocomotionPlayerController player)Client: clears the local player's movement context and unparents them.
10 private and internal methods
MemberWhat it is
private void Add(Pickup pickup)Parents a loose pickup to the platform, or for a held, docked or crafted one watches for when it becomes loose.
private void ApplyToPickup(Pickup pickup)Gives the pickup the platform's movement context, parents it, and makes the platform its chunking parent.
private void CheckPickup(NetworkEntity topic, NetworkEntity oldParent, NetworkEntity newParent)Re-checks a watched pickup after it changes parent or is let go, and applies or removes the platform.
private void CheckPickup(Interactable interactable, Interactor interactor)Re-checks a watched pickup after it changes parent or is let go, and applies or removes the platform.
private void Alta.Networking.INetworkEntityBehaviour.Initialize()Gets the entity, creates the movement context and records which side is running.
private void Alta.Networking.INetworkEntityBehaviour.InitializeAsServer(SpawnData spawnData)Empty.
private bool IsManaged(Pickup pickup)True if the pickup is held, docked or a crafted child, so the platform should not parent it.
private void Alta.Networking.INetworkEntityBehaviour.OnConnected(Player player)Empty.
private void Alta.Networking.INetworkEntityBehaviour.OnDisconnected(Player player)Empty.
private void UnapplyFromPickup(Pickup pickup)Removes the platform's movement context, parent and chunking parent from the pickup.