Skip to main content

DelayedImpactResolver

A static class in Root.Township, Alta.Impact.

Collects every collision an impact tool makes in a frame and turns them into one best hit in LateUpdate, so a swing touching several colliders only hits once. ImpactDetector feeds it.

Fields​

5 private and internal fields
MemberWhat it is
private static Dictionary<ImpactTool, List<DelayedImpactResolver.ImpactDetectorHit>> frameHitsCollisions queued this frame, grouped per impact tool.
private static Stack<List<DelayedImpactResolver.ImpactDetectorHit>> hitsPoolReused hit lists, to avoid allocating each frame.
private static Logger loggerClass logger, used when generating a hit throws.
private static IUnityUpdateMethod updateThe registered late update, or null when stopped.
private static UpdateModule updateModuleThe LateUpdate module named "Impact Detector Resolver".

Methods​

MemberWhat it is
static void Hit(ImpactTool tool, ImpactDetector impactDetector, Collision collision)Queues a tool's collision with a detector for this frame and makes sure the late update is running.
static void ProcessImmediate(ImpactTool impactTool, ImpactDetector impactDetector, Collision collision, Action<ImpactHitWithTool> hitProcessor)Picks the most effective hit from one collision right away and passes it to the callback. Used for tools that need instant processing.
static void Stop()Deregisters the late update and drops any queued hits.
3 private and internal methods
MemberWhat it is
private static void PushHitsListIntoPool(List<DelayedImpactResolver.ImpactDetectorHit> hits)Clears a hit list and returns it to the pool.
private static void Start()Registers Update with the update module if it isn't already.
private static void Update()Late update: for each tool, keeps the most effective hit across all its queued collisions, applies it, then resets that tool's impact generators.