An abstract class in Root.Township, the global namespace.
Base for trigger areas whose effect follows a network of connected SpacePoints, such as atmosphere and darkness areas. While the local player is inside, it finds the nearest point pair and reports progress between them.
Constructors
| Member | What it is |
|---|
protected SpaceDefinedAttribute() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|
protected T closestPoint | The point the player is closest to, or null outside the area. |
3 private and internal fields
| Member | What it is |
|---|
private Transform localPlayer | Transform of the collider that entered, treated as the local player. |
private int timesTriggered | Count of colliders currently inside, so enter and exit run only once. |
private IUnityUpdateMethod update | Handle of the closest point update. |
Properties
| Member | What it is |
|---|
abstract IEnumerable<T> Points { get; } | The space points that define the area. |
Methods
| Member | What it is |
|---|
protected virtual void EnterArea() | Called when the player first enters the trigger. Does nothing by default. |
protected abstract void ExitArea() | Called when the player leaves the trigger. |
protected abstract void SendNewCloserPoint(T from, T to, float progress) | Called each update with the closest point pair and the blended weight between them. |
3 private and internal methods
| Member | What it is |
|---|
private void OnTriggerEnter(Collider other) | On the first overlapping collider, tracks it as the local player, starts updating the closest point and calls EnterArea. |
private void OnTriggerExit(Collider other) | When the last collider leaves, stops updating and calls ExitArea. |
private void UpdateClosest() | Finds the nearest line between connected points to the player and sends the blended weight via SendNewCloserPoint. |