Skip to main content

CraftableImpactDetectorBase

An abstract class in Root.Township, Alta.Impact.

Base for an impact detector on a crafted part that listens to the collisions of whichever ImpactTool the part's root has, and only counts contacts a subclass accepts.

Constructors​

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

Fields​

1 private and internal field
MemberWhat it is
private CraftingPart craftingPartThe crafting part in the parents whose root tool is tracked.

Properties​

MemberWhat it is
ImpactTool RegisteredTool { get; private set; }The impact tool whose collisions are being listened to.

Methods​

MemberWhat it is
protected override void Awake()Follows the crafting part's root tool, or the ImpactTool on this object if there's no part.
protected virtual void UpdateTool(ImpactTool registeringTool)Moves the collision hook from the old tool to the new one.
protected abstract bool ValidateContatPoint(ContactPoint point)Subclasses return whether a contact point belongs to this detector.
3 private and internal methods
MemberWhat it is
private void OnDestroy()Stops listening to the tool's collisions.
private void RootSet(CraftingPart root)Called when the part's root changes; switches to the new root's impact tool.
private void ValidateCollision(Collision collision)Passes the collision on to OnCollisionEnter if any contact point passes ValidateContatPoint.