A class in Root.Township, Alta.Impact.
A trigger that raises an ImpactHit event when an ImpactTool enters it, for things that react to being hit through a trigger collider rather than a collision.
Constructors
| Member | What it is |
|---|
TriggerImpactDetector() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private ImpactChannel[] channels | Impact channels the hit is checked against. |
private float minimumDamage | A hit must do more health damage than this to count (default -1). |
private float minimumEffectiveness | A hit must be more effective than this to count (default 0.2). |
private ImpactHitEvent onHit | Backing field for OnHit. |
private Dictionary<Rigidbody, HashSet<Collider>> trackedRigidbodies | Rigidbodies inside the trigger and which of their colliders are in. |
Properties
| Member | What it is |
|---|
ImpactHitEvent OnHit { get; } | Event raised with the hit when a tool enters the trigger. |
Methods
| Member | What it is |
|---|
void Clear() | Forgets all rigidbodies inside the trigger, so the next entry counts as a new hit. |
3 private and internal methods
| Member | What it is |
|---|
private void GenerateHit(ImpactTool tool, Collider collider) | Asks the tool for its best hit on this trigger's channels and raises onHit if it is effective and strong enough. |
private void OnTriggerEnter(Collider collider) | On the first collider of a rigidbody entering, generates a hit if that rigidbody has an ImpactTool. |
private void OnTriggerExit(Collider collider) | Stops tracking a rigidbody once all its colliders have left. |
Used in
Members of other types that take, return or hold a TriggerImpactDetector: