3 const string RINGING_SOUND =
"KitchenTimer_Ring_Loop_SoundSet";
4 const string DESTROYED_SOUND =
"AlarmClock_Destroyed_SoundSet";
5 const string HIT_SOUND =
"AlarmClock_Hit_SoundSet";
6 const string WORKING_SOUND =
"KitchenTimer_Ticking_Loop_SoundSet";
30 override void SetActions()
38 override string GetExplosiveTriggerSlotName()
40 return "TriggerKitchenTimer";
43 override string GetToggleSound()
48 override string GetRingingSound()
53 string GetRingingStopSound()
55 return "KitchenTimer_Ring_End_SoundSet";
58 override string GetDestroyedSound()
60 return DESTROYED_SOUND;
63 override string GetHitSound()
68 override string GetWorkingSound()
78 int Time01ToSeconds(
float time01)
80 return Math.Lerp(0,GetMinutesMax() * 60, time01);
84 float SecondsTo01(
int seconds)
86 return Math.InverseLerp(0,GetMinutesMax() * 60, seconds);
89 override float GetRingingDurationMax()
94 override void TurnOff()
102 if (m_AlarmInSecs > 0)
104 m_AlarmInSecs -= UPDATE_TICK_RATE;
105 float time01 = SecondsTo01(m_AlarmInSecs);
106 SetAnimationPhaseNow(
"ClockAlarm", time01);
132 override protected void Disarm()
135 SetAlarmTimeServerSecs(0);
138 override protected void OnRingingStopClient()
141 PlaySoundSet(m_RingingStopSound, GetRingingStopSound(), 0, 0);
143 super.OnRingingStopClient();
149 if (!super.OnStoreLoad(ctx, version))
159 if (!ctx.Read(state))
174 SetAlarmTimeServerSecs(time);
186 super.OnStoreSave(ctx);
189 ctx.Write(m_AlarmInSecs);
198 override void SetAlarmTimeServer(
float time01)
200 SetAnimationPhaseNow(
"ClockAlarm", time01);
201 m_AlarmInSecs = Time01ToSeconds(time01);
203 if (m_AlarmInSecs > 0)
209 void SetAlarmTimeServerSecs(
int inSecs)
211 SetAlarmTimeServer(SecondsTo01(inSecs));
219 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
224 super.GetDebugActions(outputList);
229 if (super.OnAction(action_id, player, ctx))
234 if (action_id ==
EActions.ALARM_SET_AHEAD)
236 SetAlarmTimeServerSecs(20);
242 override string GetDebugText()
246 if (
GetGame().IsDedicatedServer())
248 debug_output =
"alarm in: " + m_AlarmInSecs.ToString() +
" secs" +
"\n";
251 debug_output +=
"ringing max " + GetRingingDurationMax().ToString()+
" secs" +
"\n";
255 debug_output =
"this is client";