// 强制时间恢复正常 public void NormalGameTimeScale() { m_Steps.Clear(); Time.timeScale = 1; m_isPause = false; EventMachine.SendEvent(EventID.Event_Time_ScaleChange); }
// 如果时间为0的话,代表当前时间更改没有时间限制,直到强制时间恢复正常 public void StepGameWithTime(float clock, float timescale) { counter++; timescale = Mathf.Max(timescale, 0.01f); Time.timeScale = timescale; EventMachine.SendEvent(EventID.Event_Time_ScaleChange); m_Steps.Add(counter, new Step(counter, clock, timescale)); }
// 如果帧数为0的话,代表当前更改没有帧数限制,直到强制时间恢复正常 public void StepGameWithFrames(uint frames, float timescale) { counter++; timescale = Mathf.Max(timescale, 0); Time.timeScale = timescale; EventMachine.SendEvent(EventID.Event_Time_ScaleChange); m_Steps.Add(counter, new Step(counter, frames, timescale)); }
// 移除时间限制 public void RemoveStepGame(uint id) { if (m_Steps.ContainsKey(id)) { m_Steps.Remove(id); } if (m_Steps.Count == 0 && !m_isPause) { Time.timeScale = 1; EventMachine.SendEvent(EventID.Event_Time_ScaleChange); } else if (m_Steps.Count > 0 && !m_isPause) { int num = m_Steps.Count; uint[] strKey = new uint[num]; m_Steps.Keys.CopyTo(strKey, 0); Time.timeScale = m_Steps[strKey[num - 1]].m_timescale; EventMachine.SendEvent(EventID.Event_Time_ScaleChange); } }
public static void SetNull() { instance = null; }