TriggerZone
A class in Root.Township, ATT.Triggers.
Client: a box zone that fires its zone events when the local player leaves it (or teleports through it, or logs out inside it), passing how long they were inside.
- Listed in ATT, Features and other game namespaces
- Inherits or implements
MonoBehaviour,ITeleportAwareTrigger,IForcePresenceOnAndroidClient
Constructors
| Member | What it is |
|---|---|
TriggerZone() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|---|
private int enterTimeStampInSeconds | Real time the player entered, in whole seconds. |
private Bounds localBounds | The zone box in local space. |
private ZoneEvent[] onExitTriggers | Zone events fired on exit. |
private TriggerEventData triggerEventData | Data (such as the event name) passed to the zone events. |
private bool wasPlayerInsideZone | Whether the player was inside at the last position change. |
Methods
| Member | What it is |
|---|---|
void OnTriggerTeleportedThrough(IPlayer _) | Fires the exit events when a teleport passes through the zone. |
10 private and internal methods
| Member | What it is |
|---|---|
private void ActivateExitEvent() | Fires every exit trigger with the event data and time spent, then clears the entry time. |
private bool CheckInside(Vector3 worldPosition) | True if a world position is inside the local bounds. |
private int GetDuration() | Seconds since the player entered, or 0 if no entry was recorded. |
private void LoggedOut() | Fires the exit events if the player was inside. |
private void OnDisable() | Unhooks the player, position and logout listeners. |
private void OnDrawGizmosSelected() | Draws the zone box in the editor. |
private void OnEnable() | Hooks the local player now, or when it is set. |
private void OnLocalPlayerSet(PlayerController playerController) | Listens to the local player's position changes and to logout. |
private void OnPlayerPositionChanged(PlayerController playerController, Vector3 oldPosition, Vector3 newPosition, LocomotionFunction function) | Records the entry time on entering and fires the exit events on leaving. |
private void SetEntryTimeStamp() | Stores the current real time as the entry time. |