972 {
973 #ifdef DIAG_DEVELOPER
974 if (m_StaminaDisabled)
975 return;
976 #endif
977 float val = 0.0;
978 float current_time =
m_Player.GetSimulationTimeStamp();
979 float valueProgress;
981
982
983 switch (sm.GetType())
984 {
986 if (dT == -1)
987 {
988 dT = 1;
989 }
991
992 break;
993
995 val = Math.RandomFloat(sm.GetMinValue(), sm.GetMaxValue());
997
998 break;
999
1001 if (!sm.IsInUse())
1002 {
1003 sm.SetStartTime(current_time + sm.GetStartTimeAdjustment()/dT);
1004 sm.SetRunTimeTick(dT);
1005 sm.SetInUse(true);
1006 }
1007 valueProgress = Math.Clamp((current_time - sm.GetStartTime())/sm.GetDurationAdjusted(), 0, 1 );
1008 val = Math.Lerp(sm.GetMinValue(), sm.GetMaxValue(), valueProgress);
1010
1011 break;
1012
1014 StaminaModifierExponential smex;
1015 if (!Class.CastTo(smex,sm))
1016 {
1017 ErrorEx(
"StaminaModifierExponential not found for modifier type: " + sm.GetType());
1018 break;
1019 }
1020
1021 if (!smex.IsInUse())
1022 {
1024 smex.SetRunTimeTick(dT);
1025 smex.SetInUse(true);
1026 }
1027 valueProgress = Math.Clamp((current_time - smex.GetStartTime())/smex.
GetDurationAdjusted(), 0, 1 );
1028 float exp;
1030 {
1031 exp = 1 - Math.Lerp(0, smex.
GetExponent(), valueProgress);
1033 }
1034 else
1035 {
1038 }
1039
1041
1042 break;
1043 }
1044
1047
1050 }
void StaminaModifier(int type, float min, float max, float cooldown, float startTime=0, float duration=0)
float m_StaminaDepletionMultiplier
ref StaminaModifiers m_StaminaModifiers
void SetCooldown(float time, int modifier=-1)
set cooldown timer between each consume of stamina
override float GetStartTimeAdjustment()
override float GetDurationAdjusted()