Skip to main content

BlockedTrigger

A class in Root.Township, Alta.Impact.

Fires an inspector event when its ImpactTool blocks a hit with enough effectiveness, optionally only once.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private bool disableAfterBlockWhen set, IsActive turns off after one block.
private float minimumEffectivenessLowest hit effectiveness that counts as a block.
private FloatEvent onBlockedEvent invoked with the hit's effectiveness.

Properties​

MemberWhat it is
bool IsActive { get; set; }Whether blocks currently fire the event. Starts false, so something must turn it on.

Methods​

2 private and internal methods
MemberWhat it is
private void Awake()Hooks the impact tool's OnBlocked event.
private void Blocked(ImpactHitWithTool hit, ImpactTool tool)If active and the hit's effectiveness is high enough, invokes onBlocked and maybe deactivates.