A class in Root.Township, Alta.Heat.
Scores how hard a hand (or other transform) is shaking, from its speed through a curve. MovementHeatPoint uses the score to shed heat faster when you shake a burning hand. Server side; a component on the hand, reached through Hand.ShakeDetector.
Constructors
| Member | What it is |
|---|
HandShakeOffDetector() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|
private HashSet<Object> activators | Objects that have requested the detector; it runs while any remain. |
private bool isLocalPosition | If true, measures local position, so moving the whole player doesn't count. |
private Vector3 lastPosition | Target position on the last physics step. |
private float lerpToScorePerSecond | How fast score eases toward the curve value. |
private float score | Backing field for Score. |
private AnimationCurve shakeScore | Curve from speed to shake score. |
private Transform targetTransform | Transform whose movement is measured. |
private LocomotionController teleportController | Locomotion controller watched for teleports. |
Properties
| Member | What it is |
|---|
float Score { get; } | Current shake score, eased toward the curve value each physics step. |
Methods
| Member | What it is |
|---|
override void InitializeAsServer(SpawnData spawnData) | When tracking world position, hooks the teleport controller so teleports don't count as shaking. |
void Release(Object activator) | Removes an activator; when none are left, resets the score and disables the detector. |
void Request(Object activator) | Adds an activator; the first one resets the score and enables the detector. |
3 private and internal methods
| Member | What it is |
|---|
private void FixedUpdate() | While enabled, measures the target's speed, maps it through shakeScore and eases score toward it. |
private bool Setup() | Editor setup: defaults the target to this transform and starts the component disabled. |
private void UpdatePosition(PlayerController player, Vector3 oldPosition, Vector3 newPosition, LocomotionFunction function) | Shifts the last position by a teleport's offset so the jump isn't scored as movement. |
Used in
Members of other types that take, return or hold a HandShakeOffDetector: