ShakeDetector
A class in Root.Township, the global namespace.
Component that fires an event when its rigidbody is shaken back and forth hard enough. Wraps a ShakeDetectorHelper checked every fixed update.
- Listed in Global namespace: S
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
ShakeDetector() | 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 fadePerSecond | How fast built-up shake strength fades away. |
private ShakeDetectorHelper helper | The ShakeDetectorHelper doing the work. |
private float jumpPerChange | Strength added for a full reversal of direction. |
private AltaEvent shaken | Backing field for Shaken. |
private float threshold | Strength needed to count as a shake. |
private float velocityThreshold | Speed the rigidbody must reach before a direction change counts. Squared before it is passed to the helper. |
Properties
| Member | What it is |
|---|---|
AltaEvent Shaken { get; } | Inspector event fired each time the shake strength goes over threshold. |
float Strength { get; } | Current shake build-up from the helper. Resets to 0 when a shake fires. |
Methods
2 private and internal methods
Used in
Members of other types that take, return or hold a ShakeDetector: