Skip to main content

SpaceDefinedAttribute<T>

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​

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

Fields​

MemberWhat it is
protected T closestPointThe point the player is closest to, or null outside the area.
3 private and internal fields
MemberWhat it is
private Transform localPlayerTransform of the collider that entered, treated as the local player.
private int timesTriggeredCount of colliders currently inside, so enter and exit run only once.
private IUnityUpdateMethod updateHandle of the closest point update.

Properties​

MemberWhat it is
abstract IEnumerable<T> Points { get; }The space points that define the area.

Methods​

MemberWhat 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
MemberWhat 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.