Skip to main content

LevelSelectCaveTeleporter

A class in Root.Township, Alta.Caves.

A cave teleporter whose destination layer is picked with a LevelSelector. Each level maps to a layer a set distance deeper.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private CaveTeleportConnection[] connectionsOne connection per selector level, built once the manager has synced.
private int distanceBetweenLayersHow many cave layers each selector level steps down.
private LevelSelector levelSelectorThe selector the player uses to choose a level.
private int targetLayerBacking field for TargetLayer.

Properties​

MemberWhat it is
override int TargetLayer { get; }The layer the teleporter currently sends players to.

Methods​

MemberWhat it is
override void Initialize()Listens for the teleporter manager's full sync so connections can be built.
void UpdateLevel(int level)Sets the target layer from a selector level and switches to that level's connection.
protected override void InitializeConnection()Requests a connection for every selector level, sets up the level pips on clients and applies the current level.
2 private and internal methods
MemberWhat it is
private int GetLayer(int level)Turns a selector level into a cave layer: (level + 1) * distanceBetweenLayers - 1.
private void OnDestroy()Stops listening for the manager's full sync.