4 protected WorldTimestamp m_fStartTime;
6 protected float m_fDuration;
12 void Start(WorldTimestamp timeNow)
14 m_fStartTime = timeNow;
20 WorldTimestamp GetStartTime()
30 bool IsFinished(WorldTimestamp timeNow,
float additionalTime = 0)
32 return timeNow.GreaterEqual(m_fStartTime.PlusSeconds(
m_fDuration + additionalTime));
40 float GetRemainingTime(WorldTimestamp timeNow,
float additionalTime = 0)
42 WorldTimestamp endTime = m_fStartTime.PlusSeconds(
m_fDuration + additionalTime);
43 float rem = endTime.DiffMilliseconds(timeNow);
61 void SetDuration(
float duration)
69 bool RplSave(ScriptBitWriter writer)
71 writer.Write(m_fStartTime, 64);
80 bool RplLoad(ScriptBitReader reader)
82 reader.Read(m_fStartTime, 64);
91 static void Encode(SSnapSerializerBase snapshot, ScriptCtx ctx, ScriptBitSerializer packet)
93 snapshot.Serialize(packet, 12);
97 static bool Decode(ScriptBitSerializer packet, ScriptCtx ctx, SSnapSerializerBase snapshot)
99 return snapshot.Serialize(packet, 12);
103 static bool SnapCompare(SSnapSerializerBase lhs, SSnapSerializerBase rhs, ScriptCtx ctx)
105 return lhs.CompareSnapshots(rhs, 12);
109 static bool PropCompare(
SCR_RespawnTimer prop, SSnapSerializerBase snapshot, ScriptCtx ctx)
111 return snapshot.Compare(prop.m_fStartTime, 8)
112 && snapshot.Compare(prop.m_fDuration, 4);
116 static bool Extract(
SCR_RespawnTimer prop, ScriptCtx ctx, SSnapSerializerBase snapshot)
118 snapshot.SerializeBytes(prop.m_fStartTime, 8);
119 snapshot.SerializeBytes(prop.m_fDuration, 4);
124 static bool Inject(SSnapSerializerBase snapshot, ScriptCtx ctx,
SCR_RespawnTimer prop)
126 snapshot.SerializeBytes(prop.m_fStartTime, 8);
127 snapshot.SerializeBytes(prop.m_fDuration, 4);