public void Tire(float effortCost) { if (!photonView.IsMine) { return; } // Update stamina value Stamina -= effortCost; // Clamp value if over the range if (Stamina < 0) { Stamina = Mathf.Clamp(Stamina, 0, MaxStamina); } // Notify listeners OnStaminaValueChanged?.Invoke(Stamina); // Update IsAfterActivity flag if (IsAfterActivity) { StopCoroutine(_restTimerCoroutine); _restTimerCoroutine = RestTimer(); } else { IsAfterActivity = true; } StartCoroutine(_restTimerCoroutine); }
public void StaminaRegeneration() { Stamina += StaminaRegenerationPerSecond * Time.deltaTime; if (Stamina > MaxStamina) { Stamina = Mathf.Clamp(Stamina, 0, MaxStamina); } OnStaminaValueChanged?.Invoke(Stamina); }
public void RespawnInitialization() { Health = MaxHealth; Stamina = MaxStamina; IsAfterActivity = false; IsTarget = false; _restTimerCoroutine = RestTimer(); _safeTimerCoroutine = SafeTimer(); _isDying = false; OnHealthValueChanged?.Invoke(Health); OnStaminaValueChanged?.Invoke(Stamina); }