1145 {
1146 #ifdef DIAG_DEVELOPER
1147 if (m_StaminaDisabled)
1148 return;
1149 #endif
1150 float val = 0.0;
1151 float current_time =
m_Player.GetSimulationTimeStamp();
1152 float valueProgress;
1154
1155
1156 switch (sm.GetType())
1157 {
1159 if (dT == -1)
1160 {
1161 dT = 1;
1162 }
1164
1165 break;
1166
1168 val = Math.RandomFloat(sm.GetMinValue(), sm.GetMaxValue());
1170
1171 break;
1172
1174 if (!sm.IsInUse())
1175 {
1176 sm.SetStartTime(current_time + sm.GetStartTimeAdjustment()/dT);
1177 sm.SetRunTimeTick(dT);
1178 sm.SetInUse(true);
1179 }
1180 valueProgress = Math.Clamp((current_time - sm.GetStartTime())/sm.GetDurationAdjusted(), 0, 1 );
1181 val = Math.Lerp(sm.GetMinValue(), sm.GetMaxValue(), valueProgress);
1183
1184 break;
1185
1187 StaminaModifierExponential smex;
1188 if (!Class.CastTo(smex,sm))
1189 {
1190 ErrorEx(
"StaminaModifierExponential not found for modifier type: " + sm.GetType());
1191 break;
1192 }
1193
1194 if (!smex.IsInUse())
1195 {
1197 smex.SetRunTimeTick(dT);
1198 smex.SetInUse(true);
1199 }
1200 valueProgress = Math.Clamp((current_time - smex.GetStartTime())/smex.
GetDurationAdjusted(), 0, 1 );
1201 float exp;
1203 {
1204 exp = 1 - Math.Lerp(0, smex.
GetExponent(), valueProgress);
1206 }
1207 else
1208 {
1211 }
1212
1214
1215 break;
1216 }
1217
1220
1223 }
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()