Skip to main content

StaminaBarVisibility

A class in Root.Township, Alta.StatSystem.

Client: fades the local player's left and right hand stamina bars in while stamina is below full and out when full. Hidden while downed.

Constructors​

MemberWhat it is
StaminaBarVisibility()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

7 private and internal fields
MemberWhat it is
private float alphaLerpSpeedAlpha change per second when fading.
private StatBarBase[] leftStaminaStat bars for the left hand.
private StaminaBarVisibility.HandStaminaView leftStaminaViewFade logic for the left hand.
private PlayerController playerThe player controller whose death hides the bars.
private StatBarBase[] rightStaminaStat bars for the right hand.
private StaminaBarVisibility.HandStaminaView rightStaminaViewFade logic for the right hand.
private Material staminaNotchMaterialNotch material, cloned per hand and faded with the bars.

Methods​

6 private and internal methods
MemberWhat it is
private void Awake()Initializes now if the local player controller exists, otherwise when it's set.
private void Initialize(PlayerController controller = null)Builds the left and right views and hooks the player's death.
private void LateUpdate()Updates both hands' bar alpha.
private void OnDestroy()Unhooks the local player and death events.
private void OnEnable()Sets both views' alpha to 0.
private void PlayerDeath(HealthObject health)Disables both hands' stamina bars.