TeleportationPoint
A class in Root.Township, the global namespace.
Custom teleport target: when the local player's teleporter points at it, moves them to a saved target position instead. The target and mode are saved and synced to players.
- Listed in Global namespace: T to X
- Inherits or implements
CustomTeleportation,ISavable<TeleportationPointSaveData>,ISavableSave<TeleportationPointSaveData>,ISavableSaveBase - Derived types
TeleportationPointSaveData
Constructors
| Member | What it is |
|---|---|
TeleportationPoint() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private GameObject effect | Object shown while a teleporter aims at this point. |
private MethodSync sync | Method sync for the target position and mode. |
private Transform target | Transform the player is sent to. |
private TeleportMode teleportMode | How the target is applied (feet by default). |
Methods
| Member | What it is |
|---|---|
override bool Attempt(Teleporter teleporter) | Teleports the player if the teleporter belongs to a PlayerCharacter; returns whether it did. |
override void Begin(Teleporter teleporter) | Shows the effect while a teleporter aims here. |
override void End(Teleporter teleporter) | Hides the effect. |
override void Initialize() | Sets up the method sync for the target. |
override void OnConnected(Player player) | Server: sends the target position and mode to the joining player. |
void PositionTarget(Vector3 position) | Moves the target to a world position and syncs it to players in the chunk. |
void TeleportPlayer(PlayerController playerController) | Client: moves the local player to the target with the chosen TeleportMode. Does nothing for other players. |