public void Add <T> (T _instance_) { IUpdate update = _instance_ as IUpdate; if (update != null) { AddUpdate(update); } IFixedUpdate fixedUpdate = _instance_ as IFixedUpdate; if (fixedUpdate != null) { AddFixedUpdate(fixedUpdate); } ILateUpdate lateUpdate = _instance_ as ILateUpdate; if (lateUpdate != null) { AddLateUpdate(lateUpdate); } #if UNITY_EDITOR UpdateRuntimeTimerCount(); #endif }
public void Remove <T> (T _inst) { IUpdate update = _inst as IUpdate; if (update != null) { RemoveUpdate(update); } IFixedUpdate fixedUpdate = _inst as IFixedUpdate; if (fixedUpdate != null) { RemoveFixedUpdate(fixedUpdate); } ILateUpdate lateUpdate = _inst as ILateUpdate; if (lateUpdate != null) { RemoveLateUpdate(lateUpdate); } #if UNITY_EDITOR UpdateRuntimeTimerCount(); #endif }
/// <summary> /// 是否存在此实例 /// </summary> /// <param name="_instance_"></param> /// <returns></returns> public bool Exist <T> (T _instance_) { IUpdate update = _instance_ as IUpdate; if (update != null) { return(_UpdateStore.Contains(update)); } IFixedUpdate fixedUpdate = _instance_ as IFixedUpdate; if (fixedUpdate != null) { return(_FixedUpdateStore.Contains(fixedUpdate)); } ILateUpdate lateUpdate = _instance_ as ILateUpdate; if (lateUpdate != null) { return(_LateUpdateStore.Contains(lateUpdate)); } return(false); }
private void RemoveFixedUpdate(IFixedUpdate fixedUpdate) { if (_FixedUpdateStore.Contains(fixedUpdate)) { _FixedUpdateStore.Remove(fixedUpdate); FixedUpdateStore = _FixedUpdateStore.ToArray(); } }
/// <summary> /// Removes a new that needs to be called every fixed framerate frame. /// </summary> /// <param name="update"></param> public void RemoveFixedUpdate(IFixedUpdate update) { // Don't do anything if the object will be destroyed. if (destroying) { return; } FixedUpdateList.Remove(update); }
/// <summary> /// Adds a new component that needs to be called every fixed framerate frame. /// </summary> /// <param name="update"></param> public void AddFixedUpdate(IFixedUpdate update) { // Don't do anything if the object will be destroyed. if (m_Destroying) { return; } FixedUpdateList.Add(update); }
public void AddFixedUpdater(IFixedUpdate fixedUpdater) { #if DEBUG if (fixedUpdaters.Contains(fixedUpdater)) { Debug.LogError("The updater has been added to the list"); return; } #endif fixedUpdaters.Add(fixedUpdater); }
public static void RegisteIFixedUpdate(IFixedUpdate single) { if (single == null) { return; } if (!listFixedUpdate.Contains(single)) { listFixedUpdate.Add(single); } }
public static void UnRegisteIFixedUpdate(IFixedUpdate single) { if (single == null) { return; } if (listFixedUpdate.Contains(single)) { listFixedUpdate.Remove(single); } }
public static void FixUpdate() { for (int i = 0; i < listFixedUpdate.Count; i++) { IFixedUpdate single = listFixedUpdate[i]; if (single != null) { UnityEngine.Profiling.Profiler.BeginSample(single.GetType() + "FixUpdate"); single.OnFixedUpdate(UnityEngine.Time.deltaTime); UnityEngine.Profiling.Profiler.EndSample(); } } }
public void AddUpdate(IFixedUpdate target) { if (CheckNull(target)) { return; } if (_targetsFixedUpdate.Exists(t => t == target)) { return; } _targetsFixedUpdate.Add(target); }
/// <summary> /// Removes a new that needs to be called every fixed framerate frame. /// </summary> /// <param name="update"></param> public static void RemoveFixedUpdate(IFixedUpdate update) { // Make sure the Update Manager isn't being used in the editor. if (!Application.isPlaying) { Debug.LogWarning("Update Manager can not be used outside the game!"); return; } // Remove the update on the instance. if (UpdateManagerBehaviour.Instance) { UpdateManagerBehaviour.Instance.RemoveFixedUpdate(update); } }
public static void RemoveFixedUpdateList(IFixedUpdate fixedUpdate) { fixedUpdates.Remove(fixedUpdate); }
public static void AddFixedUpdateList(IFixedUpdate fixedUpdate) { fixedUpdates.Add(fixedUpdate); }
public static void RemoveFixedUpdate(IFixedUpdate updater) => GetRunner().m_FixedUpdates.Remove(updater);
public static void AddFixedUpdate(IFixedUpdate updater) => GetRunner().m_FixedUpdates.Add(updater);
private void AddFixedUpdate(IFixedUpdate fixedUpdate) { _FixedUpdateStore.Add(fixedUpdate); FixedUpdateStore = _FixedUpdateStore.ToArray(); }
public void RemoveUpdate(IFixedUpdate target) { _targetsFixedUpdate.Remove(target); }
internal void AddFixedUpdate(IFixedUpdate fixedUpdate) { _fixedUpdatesList.Add(fixedUpdate); }
public static void AddFixedUpdate(IFixedUpdate updater) => sm_Updater?.m_FixedUpdates.Add(updater);
public void RemoveFixedUpdater(IFixedUpdate fixedUpdater) { fixedUpdaters.Remove(fixedUpdater); }
public static void RemoveFixedUpdate(IFixedUpdate updater) => sm_Updater?.m_FixedUpdates.Remove(updater);
private void SetUpdates(AbstractStateBase abstractState) { _fixedUpdate = abstractState as IFixedUpdate; _lateUpdate = abstractState as ILateUpdate; _update = abstractState as IUpdate; }