12 public float EnergyBarEaseFactor;
13 public float HeartScaleEaseFactor;
14 public float HeartMinScale;
15 public float HeartMaxScale;
18 Transform _heartTransform;
22 int _isTargetHash = Animator.StringToHash(
"IsTarget");
23 int _isExtremeHash = Animator.StringToHash(
"IsExtreme");
30 _instance._character = provider;
36 _energyBarFill = transform.FindChild(
"energy_bar/fill").GetComponent<Image>();
37 _heartTransform = transform.FindChild(
"heart");
38 _heartAnim = _heartTransform.GetComponent<Animator>();
46 void OnHeartTierChange(HeartTier newTier, HeartTier prevTier)
48 _heartAnim.SetBool(_isTargetHash, newTier == HeartTier.Target);
49 _heartAnim.SetBool(_isExtremeHash, newTier == HeartTier.Extreme);
54 if (_character != null)
56 _energyBarFill.fillAmount = Mathf.Lerp(_energyBarFill.fillAmount, _character.Energy, Time.deltaTime * EnergyBarEaseFactor);
57 _energyBarFill.SetAllDirty();
60 _energyBarFill.fillAmount = Mathf.Lerp(_energyBarFill.fillAmount, 0, Time.deltaTime * EnergyBarEaseFactor);
62 _heartTransform.localScale = Vector3.Lerp(_heartTransform.localScale,
64 Time.deltaTime * HeartScaleEaseFactor);
A visual representation of HeartRate and Character.Energy.
Heart class. Allows for heart rate queries and heart rate injection from devices. ...
static void RegisterEnergyProvider(Character provider)
Register an instance of a Character (usually the player's local avatar's Character component) to act ...
Avatar character management component. In charge of personas, skills and buffs.
static float NormalizedRate
Gets the current heart rate divded by the target heart rate.
static HeartTierChangedHandler TierChanged
Event fired when the heart rate tier changes.