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
| Member | What it is |
|---|
protected CraftableImpactDetectorBase() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
1 private and internal field
| Member | What it is |
|---|
private CraftingPart craftingPart | The crafting part in the parents whose root tool is tracked. |
Properties
| Member | What it is |
|---|
ImpactTool RegisteredTool { get; private set; } | The impact tool whose collisions are being listened to. |
Methods
| Member | What 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
| Member | What 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. |