1111 {
1112 #ifdef DIAG_DEVELOPER
1113 if (m_StaminaDisabled)
1114 return;
1115 #endif
1116 float val = 0.0;
1117 float current_time =
m_Player.GetSimulationTimeStamp();
1118 float valueProgress;
1120
1121
1122 switch (sm.GetType())
1123 {
1125 if (dT == -1)
1126 {
1127 dT = 1;
1128 }
1130
1131 break;
1132
1134 val = Math.RandomFloat(sm.GetMinValue(), sm.GetMaxValue());
1136
1137 break;
1138
1140 if (!sm.IsInUse())
1141 {
1142 sm.SetStartTime(current_time + sm.GetStartTimeAdjustment()/dT);
1143 sm.SetRunTimeTick(dT);
1144 sm.SetInUse(true);
1145 }
1146 valueProgress = Math.Clamp((current_time - sm.GetStartTime())/sm.GetDurationAdjusted(), 0, 1 );
1147 val = Math.Lerp(sm.GetMinValue(), sm.GetMaxValue(), valueProgress);
1149
1150 break;
1151
1153 StaminaModifierExponential smex;
1154 if (!Class.CastTo(smex,sm))
1155 {
1156 ErrorEx(
"StaminaModifierExponential not found for modifier type: " + sm.GetType());
1157 break;
1158 }
1159
1160 if (!smex.IsInUse())
1161 {
1163 smex.SetRunTimeTick(dT);
1164 smex.SetInUse(true);
1165 }
1166 valueProgress = Math.Clamp((current_time - smex.GetStartTime())/smex.
GetDurationAdjusted(), 0, 1 );
1167 float exp;
1169 {
1170 exp = 1 - Math.Lerp(0, smex.
GetExponent(), valueProgress);
1172 }
1173 else
1174 {
1177 }
1178
1180
1181 break;
1182 }
1183
1186
1189 }
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()