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.
- Listed in Global namespace: T to X
- Inherits or implements
ScriptableObject - Attributes
CreateAssetMenu
Constructors
| Member | What it is |
|---|---|
TeleportDefinition() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private float delayBetweenOriginAndDestinationVfx | Seconds between the origin effect and moving the player. |
private PooledObjectDefinition teleportDestinationVfx | Pooled effect played where the player arrives. Optional. |
private TeleportDefinitionNetworkMessenger teleportMessenger | Network messenger set by SetupDefinition, used to send the effects to other players. Null until set. |
private PooledObjectDefinition teleportOriginVfx | Pooled effect played where the player leaves from. Optional. |
Methods
| Member | What 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: