ContactProjectile
An abstract class in Root.Township, Alta.Impact.
Base for an old projectile that reacts when its impactor hits something. It records the hit direction and calls OnContact when the impactor resets. Only NetworkContactProjectile derives from it, and that is obsolete.
- Listed in Items, inventory and logic
- Inherits or implements
MonoBehaviour,IToolHitDependant,IImpactorResetEffect - Derived types
NetworkContactProjectile - Documented in Impacts and hit detection
Constructors
| Member | What it is |
|---|---|
protected ContactProjectile() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Properties
Methods
| Member | What it is |
|---|---|
void OnCollided(Collision collision, bool isHitting, ImpactTool tool) | Records the first contact's normal as LastHitRotation. |
void OnHit(ImpactHitWithTool hit, ImpactTool tool) | Records the reverse of the tool hit's direction as LastHitRotation, or straight up if the hit had no direction. |
void ResetEffect() | Called by the impactor on reset: stops the rigidbody and calls OnContact. |
protected virtual void Awake() | Registers this projectile with every ImpactGenerator in its children so their reset calls ResetEffect. |
protected abstract void OnContact() | Subclass hook run when the impactor resets after a hit. |