Skip to main content

TeleportDefinition

A class in Root.Township, the global namespace.

Asset that teleports a player with origin and destination effects, used by climbing tower teleporter nodes. Effects are sent to other clients through a TeleportDefinitionNetworkMessenger.

Constructors​

MemberWhat it is
TeleportDefinition()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

4 private and internal fields
MemberWhat it is
private float delayBetweenOriginAndDestinationVfxSeconds between the origin effect and moving the player.
private PooledObjectDefinition teleportDestinationVfxPooled effect played where the player arrives. Optional.
private TeleportDefinitionNetworkMessenger teleportMessengerNetwork messenger set by SetupDefinition, used to send the effects to other players. Null until set.
private PooledObjectDefinition teleportOriginVfxPooled effect played where the player leaves from. Optional.

Methods​

MemberWhat it is
void PlayDestinationVfx(Vector3 position)Spawns the destination effect at a position. Does nothing on a headless server.
void PlayOriginVfx(Vector3 position)Spawns the origin effect at a position. Does nothing on a headless server.
void SetupDefinition(TeleportDefinitionNetworkMessenger newTeleportMessenger)Stores the network messenger. Called by TeleportDefinitionNetworkMessenger.Initialize.
async void TeleportPlayerAndRotateTo(PlayerController player, PositionAndRotationTarget target)Plays the origin effect, waits the set delay, moves the player and faces them, then plays the destination effect. Effects are synced to chunks.
async void TeleportPlayerTo(PlayerController player, Vector3 destinationPosition)Same as TeleportPlayerAndRotateTo with the player facing world forward.

Used in​

Members of other types that take, return or hold a TeleportDefinition: