PlayerUnlockStation
A class in Root.Township, the global namespace.
A station in a climbing challenge (PlayerUnlock): start, orb checkpoint, completion, or a permanent unlock. Server side; touching it sets the player's checkpoint and adds its orb.
- Listed in Global namespace: P
- Inherits or implements
NetworkEntityBehaviour,ISavable<PlayerUnlockStationSaveData>,ISavableSave<PlayerUnlockStationSaveData>,ISavableSaveBase - Derived types
PlayerUnlockStationSaveData - Nested types
InteractionInfo,NetworkEffect,UnlockStationType - Documented in Skills and unlocks
Constructors
| Member | What it is |
|---|---|
PlayerUnlockStation() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
17 private and internal fields
| Member | What it is |
|---|---|
private IAnalyticsService analyticsService | Injected analytics service. |
private PlayerUnlock climbingUnlock | The PlayerUnlock (challenge) this station belongs to. |
private float cooldown | Seconds between interactions with the station. Defaults to 1. |
private float cooldownEndTime | Time the cooldown ends. |
private HandHoverPoint handHover | Hand hover point the player charges to use the station; its activation calls Interact on the server. |
private Interactable interactable | Interactable whose filter decides who can use the station. |
private float interactionDelay | Seconds the server waits after activation before handling it. |
private readonly Logger logger | NLog logger for this class. |
private int orbIndex | Backing field for OrbIndex; -1 for no orb. |
private Transform orbParent | Where the orb model is placed. |
private PlayerUnlockStation.UnlockStationType stationType | Backing field for StationType. |
private MethodSyncStruct<PlayerUnlockStation.NetworkEffect> syncEffect | Method sync for station effects. |
private MethodSyncStruct<PlayerUnlockStation.InteractionInfo> syncInteractionInfoToClient | Method sync for interaction results. |
private MethodSync syncSaveDataToClient | Method sync for the station setup. |
private AltaEvent triggeredCancelled | Event played when a challenge is cancelled. |
private AltaEvent triggeredComplete | Event played when a challenge is completed. |
private AltaEvent triggeredUnlock | Event played when an orb is collected. |
Properties
| Member | What it is |
|---|---|
int OrbIndex { get; } | Orb this station gives, or -1. Normal stations need the previous orb before you can use them. |
PlayerUnlockStation.UnlockStationType StationType { get; } | Normal, Start, Completion or Unlock. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Sets up sync messages and the interaction filter. Clients set up the hand hover hint. |
override void InitializeAsServer(SpawnData spawnData) | Server: spawns the orb visual and handles the hand hover activation. |
void Inject(IAnalyticsService newAnalyticsService) | Receives the analytics service. |
async void Interact(IPlayer player) | Server: with a cooldown and optional delay, runs the station for the player (start, checkpoint and orb, or completion) and sends the result to them. |
override void OnConnected(Player player) | Server: sends the station's unlock, orb index and type to a joining player. |
bool PlayerHasAllOrbs(IPlayer player) | True if the player has this station's orb. On a completion station that orb index stands for the last one. |
18 private and internal methods
| Member | What it is |
|---|---|
private void AddOrb(IPlayer player) | Server: gives the player this station's orb and plays the unlock effect for the chunk. |
private void CancelUnlock(IPlayer player, PlayerUnlockStation.NetworkEffect effect) | Server: ends the player's current challenge and plays an effect (complete or cancelled) for the chunk. |
private bool CanInteractWithUnlockStation(IPlayer player) | True if the player has a challenge running and already holds the previous orb (index minus 1). |
private void FilterStationInteraction(Interactor interactor, Interactable interactable, ref bool result) | Blocks the hand hover on normal and unlock stations for players who can't use them yet. |
private bool HandHoverHasContent() | Client attracting check: start and completion stations always attract; others only when the local player can use them. |
private void InitializeHandHoverAttractingState(PlayerController _) | Gives the hand hover point its attracting check. |
private void InteractWithCompletionStation(IPlayer player) | If the player holds the final orb, takes all orbs and completes the challenge. |
private void InteractWithStartStation(IPlayer player) | Starts this station's challenge for the player and clears their orbs. |
private void InteractWithStation(IPlayer player) | Runs the start or unlock behaviour for the station type; normal stations do nothing extra. |
private void InteractWithUnlockStation(IPlayer player) | Gives the player this station's unlock permanently. |
private void RemoveOrbs(IPlayer player) | Takes every orb from the player. |
private void SendAnalyticsEvent(PlayerUnlockStation.InteractionInfo interactionInfo) | Client: sends a challenge completed or checkpoint reached analytics event. |
private void SetCheckpoint(IPlayer player) | Sets the player's challenge checkpoint to their feet position. |
private void SetupHandHoverAttractingState() | Client: sets up the attracting check once the local player exists. |
private void SpawnOrb() | Client: places this station's orb model under orbParent. |
private void SyncEffect(IPlayer player, Stream stream, PlayerUnlockStation.NetworkEffect arguments) | Plays the unlock, complete or cancelled event on remote clients. |
private void SyncInteractionInfoToClient(IPlayer player, Stream stream, PlayerUnlockStation.InteractionInfo interactionInfo) | Sends the interaction result to the player, whose client turns it into an analytics event. |
private void SyncSaveDataToClient(IPlayer player, Stream stream) | Sends the unlock, orb index and station type to a client, which then spawns the orb. |
Used in
Members of other types that take, return or hold a PlayerUnlockStation: