/// <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); }
public void LateUpdate() { while (this.lateUpdates.Count > 0) { Disposer disposer = this.lateUpdates.Dequeue(); if (disposer.Id == 0) { continue; } if (!this.disposerEvents.TryGetValue(disposer.GetType(), out IObjectEvent objectEvent)) { continue; } this.lateUpdates2.Enqueue(disposer); ILateUpdate iLateUpdate = objectEvent as ILateUpdate; if (iLateUpdate == null) { continue; } objectEvent.Set(disposer); try { iLateUpdate.LateUpdate(); } catch (Exception e) { Log.Error(e.ToString()); } } ObjectHelper.Swap(ref this.lateUpdates, ref this.lateUpdates2); }
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 }
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 }
private void RemoveLateUpdate(ILateUpdate lateUpdate) { if (_LateUpdateStore.Contains(lateUpdate)) { _LateUpdateStore.Remove(lateUpdate); LateUpdateStore = _LateUpdateStore.ToArray(); } }
public static void RemoveLateUpdate(ILateUpdate update) { var _ = instance; while (lateUpdateList.Remove(update.OnLateUpdate)) { } }
public static void AddLateUpdate(ILateUpdate update) { var _ = instance; if (!lateUpdateList.Contains(update.OnLateUpdate)) { lateUpdateList.Add(update.OnLateUpdate); } }
/// <summary> /// Removes a new that needs to be called every frame. /// </summary> /// <param name="update"></param> public void RemoveLateUpdate(ILateUpdate update) { // Don't do anything if the object will be destroyed. if (destroying) { return; } LateUpdateList.Remove(update); }
/// <summary> /// Adds a new component that needs to be called every frame. /// </summary> /// <param name="update"></param> public void AddLateUpdate(ILateUpdate update) { // Don't do anything if the object will be destroyed. if (m_Destroying) { return; } LateUpdateList.Add(update); }
public static void RegisteILateUpdate(ILateUpdate single) { if (single == null) { return; } if (!listLaterUpdate.Contains(single)) { listLaterUpdate.Add(single); } }
public static void UnRegisteILateUpdate(ILateUpdate single) { if (single == null) { return; } if (listLaterUpdate.Contains(single)) { listLaterUpdate.Remove(single); } }
public void AddLateUpdater(ILateUpdate lateUpdater) { #if DEBUG if (lateUpdaters.Contains(lateUpdater)) { Debug.LogError("The updater has been added to the list"); return; } #endif lateUpdaters.Add(lateUpdater); }
public void AddUpdate(ILateUpdate target) { if (CheckNull(target)) { return; } if (_targetsLateUpdate.Exists(t => t == target)) { return; } _targetsLateUpdate.Add(target); }
/// <summary> /// Removes a new that needs to be called every frame. /// </summary> /// <param name="update"></param> public static void RemoveLateUpdate(ILateUpdate 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.RemoveLateUpdate(update); } }
public static void LateUpdate(float ElapsedSeconds) { for (int i = 0; i < listLaterUpdate.Count; i++) { ILateUpdate single = listLaterUpdate[i]; if (single != null) { UnityEngine.Profiling.Profiler.BeginSample(single.GetType() + "LateUpdate"); single.OnLateUpdate(ElapsedSeconds); UnityEngine.Profiling.Profiler.EndSample(); } } }
private void RemoveUpdate(IBusiness removeItem) { if (removeItem is IUpdate) { IUpdate iupdate = removeItem as IUpdate; if (lisUpdate.Contains(iupdate)) { lisUpdate.Remove(iupdate); } } if (removeItem is ILateUpdate) { ILateUpdate ilateUpdate = removeItem as ILateUpdate; if (lisLateUpdate.Contains(ilateUpdate)) { lisLateUpdate.Remove(ilateUpdate); } } }
public void LateUpdate() { unique.Clear(); while (this.lateUpdates.Count > 0) { ObjectDisposer disposer = this.lateUpdates.Dequeue(); if (disposer.IsDispose) { continue; } if (!this.unique.Add(disposer)) { continue; } IObjectEventFacade objectSystem; if (!this.disposerEvents.TryGetValue(disposer.GetType(), out objectSystem)) { continue; } this.lateUpdates2.Enqueue(disposer); ILateUpdate iLateUpdate = objectSystem as ILateUpdate; if (iLateUpdate == null) { continue; } objectSystem.Set(disposer); try { iLateUpdate.LateUpdate(); } catch (Exception e) { Logger.LogError(e.ToString()); } } ObjectHelper.Swap(ref this.lateUpdates, ref this.lateUpdates2); }
public void LateUpdate(float deltaTime) { while (this.lateUpdates.Count > 0) { ECS_Disposer disposer = this.lateUpdates.Dequeue(); if (disposer.Id == 0) { continue; } IObjectEvent objectEvent; if (!this.disposerEvents.TryGetValue(disposer.GetType(), out objectEvent)) { continue; } this.lateUpdates2.Enqueue(disposer); ILateUpdate iLateUpdate = objectEvent as ILateUpdate; if (iLateUpdate == null) { continue; } objectEvent.Set(disposer); #if UNITY_EDITOR iLateUpdate.LateUpdate(deltaTime); #else try { iLateUpdate.LateUpdate(deltaTime); } catch (Exception e) { Logger.LogError(e.ToString()); } #endif } ObjectHelper.Swap(ref this.lateUpdates, ref this.lateUpdates2); }
public static void AddLateUpdate(ILateUpdate updater) => sm_Updater?.m_LateUpdates.Add(updater);
public void RemoveLateUpdater(ILateUpdate lateUpdater) { lateUpdaters.Remove(lateUpdater); }
public void RemoveUpdate(ILateUpdate target) { _targetsLateUpdate.Remove(target); }
private void AddLateUpdate(ILateUpdate lateUpdate) { _LateUpdateStore.Add(lateUpdate); LateUpdateStore = _LateUpdateStore.ToArray(); }
/// <summary> /// Unregister an object from Late update. /// </summary> public void Unregister(ILateUpdate _update) => lateUpdates.Remove(_update);
// ------------------------------ /// <summary> /// Register an object on Late update. /// </summary> public void Register(ILateUpdate _update) => lateUpdates.Add(_update);
public static void RemoveLateUpdate(ILateUpdate updater) => GetRunner().m_LateUpdates.Remove(updater);
public static void AddLateUpdate(ILateUpdate updater) => GetRunner().m_LateUpdates.Add(updater);
public static void RemoveLateUpdate(ILateUpdate updater) => sm_Updater?.m_LateUpdates.Remove(updater);
public static void Remove(ILateUpdate handler) { self.lateUpdates.Remove(handler); self.count = self.lateUpdates.Count; }
private void SetUpdates(AbstractStateBase abstractState) { _fixedUpdate = abstractState as IFixedUpdate; _lateUpdate = abstractState as ILateUpdate; _update = abstractState as IUpdate; }