EmbeddableSurface
A class in Root.Township, Alta.Impact.
Lets tools stick into a surface: a hard enough hit wedges the tool in with a spring joint until it is pulled out past breakDistance.
- Listed in Items, inventory and logic
- Inherits or implements
MonoBehaviour - Attributes
RequireComponent
Constructors
| Member | What it is |
|---|---|
EmbeddableSurface() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private float breakDistance | How far the tool must be pulled back before it comes free. |
private float damper | Damper on the joint's spring. |
private ImpactDetector detector | The impact detector on this object. |
private float minimumDamage | Lowest health damage that makes the tool stick. |
private AnimationCurve spring | Joint spring strength by distance pulled out. |
private float wedgeDistance | How far the tool is pushed in along the hit direction. |
Methods
4 private and internal methods
| Member | What it is |
|---|---|
private IEnumerator CheckBreak(ImpactHitWithTool impact, ConfigurableJoint joint, Pickup pickup) (iterator) | Coroutine that adjusts the joint spring as the tool is pulled and removes the joint once pulled out past breakDistance. |
private void Hit(ImpactHit rawImpact) | On a hit above minimumDamage, snaps the tool in slightly and joins it to what it struck. |
private void OnDisable() | Unhooks the detector's Hit event. |
private void OnEnable() | Hooks the detector's Hit event. |