ImpactHitThresholdTrigger
A class in Root.Township, Alta.Impact.
Fires inspector events when an ImpactDetector takes a hit above set effectiveness and damage, with an extra event naming the player who hit it.
- Listed in Items, inventory and logic
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
ImpactHitThresholdTrigger() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private bool checksForPlayers | Whether the player event has listeners, so the hitting player is looked up. |
private ImpactDetector detector | The impact detector listened to. |
private float minimumDamage | Lowest health damage that counts. |
private float minimumEfficiency | Lowest hit effectiveness that counts. |
private PositionEvent OnEffectivelyHit | Event invoked with the hit point for each hit that passes. |
private PlayerEvent onEffectivelyHitByPlayer | Event invoked with the player who made a passing hit, from the tool or the wielder. |
Methods
2 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Hooks the detector's Hit event and notes whether the player event has listeners. |
private void OnHit(ImpactHit impact) | Checks the thresholds, then invokes the player event (if used) and the position event. |