ShakeInput
A class in Root.Township, the global namespace.
Skill input method that turns on when the player shakes the held item. Created by ShakeInputStructure.GetNewInput and driven by the held pickup's skill handling.
- Listed in Global namespace: S
- Inherits or implements
ISkillInputMethod
Constructors
| Member | What it is |
|---|---|
ShakeInput() | Creates a ShakeInput with default values. |
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private ShakeDetectorHelper shakeHelper | Detector that measures shaking of the pickup's rigidbody. |
private float shakenTime | Real time of the last detected shake. |
private ShakeInputStructure shakeStructure | The ShakeInputStructure settings this input was registered with. |
Properties
| Member | What it is |
|---|---|
HeldPickupHandler Handler { get; private set; } | The held pickup handler this input was registered with. |
bool IsActive { get; private set; } | True from a detected shake until HeldDeactivation seconds have passed. |
2 private and internal properties
Events
| Member | What it is |
|---|---|
event Action<bool, ISkillInputMethod> ChangedActive | Raised with true when a shake is detected and false when it times out or is reset. |
Methods
6 private and internal methods
| Member | What it is |
|---|---|
private void ISkillInputMethod.Clear() | Does nothing. |
private void OnShaken() | Called by the shake detector. Activates the input, records the time and raises ChangedActive. |
private bool ISkillInputMethod.ReceiveHit(HeldPickupHandler handler, ImpactHitWithTool hitWithTool, ProfessionSkill skill) | Ignores the hit and returns false. |
private void ISkillInputMethod.RegisterHandler(HeldPickupHandler pickupHandler, SkillInputStructure structure, ProfessionSkill skill) | Stores the handler and builds a ShakeDetectorHelper on the pickup's rigidbody using the structure's thresholds. |
private void ISkillInputMethod.Reset(bool isCallingEvent) | Deactivates the input, raising ChangedActive only if asked to. |
private void ISkillInputMethod.Update() | While active, deactivates after the hold time runs out; while inactive, checks the rigidbody for a new shake. |