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
| Member | What it is |
|---|
PlayerInPositionObserver() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|
private float distanceThreshold | Distance in metres that counts as in position. Defaults to 3. |
private Domain domain | The tutorial domain this observer is in. |
private bool isSearching | Whether the polling loop is running. |
private static readonly Logger logger | Class logger. |
private int searchIntervalSeconds | Seconds between checks. Defaults to 1. |
private IPlayer targetPlayer | The domain's player being watched. |
Methods
5 private and internal methods
| Member | What 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. |