Skip to main content

PlayerInPositionObserver

A class in Root.Township, ATT.MicroTutorial.Steps.

Placed in a step's dynamic content. Server: polls the domain's player and broadcasts PlayerInPositionEvent once their feet are within range.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private float distanceThresholdDistance in metres that counts as in position. Defaults to 3.
private Domain domainThe tutorial domain this observer is in.
private bool isSearchingWhether the polling loop is running.
private static readonly Logger loggerClass logger.
private int searchIntervalSecondsSeconds between checks. Defaults to 1.
private IPlayer targetPlayerThe domain's player being watched.

Methods​

5 private and internal methods
MemberWhat it is
private void OnDisable()Server: stops the polling loop.
private void OnDrawGizmos()Draws the trigger radius in the editor.
private async void SearchForPlayerInRange()Every searchIntervalSeconds, checks the player's feet distance and broadcasts the event once in range, then stops.
private void Start()Server: finds the parent Domain, takes its player and starts searching. Logs an error outside a domain.
private void StopSearching()Ends the polling loop.