Skip to main content

HandStaminaManager

A class in Root.Township, Features.Climbing.

Per-hand climbing stamina: drains the hand's stamina stat while gripping and regenerates it while not, and asks for the hand shake-off detector while stamina is below full.

Constructors​

MemberWhat it is
HandStaminaManager(ClimbingHand climbingHand, Stat stamina, ClimbingHandler climbingHandler)Creates a HandStaminaManager from climbingHand, stamina and climbingHandler.

Fields​

6 private and internal fields
MemberWhat it is
private ClimbingHand handThe climbing hand this manager tracks.
private ClimbingHandler handlerThe climbing handler, source of the stamina settings.
private HandShakeOffDetector handShakeBacking field for HandShake.
private float lastClimbingtimeReal time this hand last gripped, passed to the regen formula.
private Stat staminaBacking field for Stamina.
private const float StaminaToleranceForFloatComparisons0.01, used for the empty and full checks.

Properties​

MemberWhat it is
HandShakeOffDetector HandShake { get; }The hand's shake-off detector, whose score feeds stamina regen.
bool HasStamina { get; }True while stamina is above 0.01.
Stat Stamina { get; }The stamina Stat this hand drains.

Methods​

MemberWhat it is
void Process()Per-frame update: drains stamina by grip, layer and hanging multipliers, or regenerates it, then requests or releases the shake detector.
1 private and internal method
MemberWhat it is
private float GetGripStaminaConsumption(float distance)Stamina drain per second from grip force over base weight, scaled by the hand distance curve. Returned as a negative number.