public virtual void OnEnable() { if (state.enabled || state.requireStarter || state.requireActorParent) { return; } state.released = false; state.enabled = true; if (ProcessingSignals.TryAddToGlobal(this)) { if (signals == null) { signals = new ProcessingSignals(); } signals.Add(this); } ProcessingUpdate.Default.Add(this); HandleEnable(); }
protected virtual void Awake() { selfTransform = transform; state.enabled = false; state.initialized = false; conditionSignals = ProcessingSignals.Check(this); if (Starter.initialized == false) { state.requireStarter = true; return; } if (state.requireActorParent) { actorParent = GetComponentInParent <Actor>(); } Setup(); state.initialized = true; }
//TODO: refactor public override void OnDisable() { if (Toolbox.isQuittingOrChangingScene() || state.released || !state.enabled) { return; } state.enabled = false; state.disabled = true; ProcessingEntities.Default.CheckGroups(id, false); var len = compositionNoTags.Count; int i; for (i = 0; i < len; i++) { Behavior.behaviors[compositionNoTags[i]].RemoveElement(id); } len = compositions != null ? compositions.Count : -1; for (i = 0; i < len; i++) { var composition = compositions[i]; if (composition.changed || !composition.Contain(tags)) { continue; } composition.changed = true; var l = composition.ids.Count; for (var j = 0; j < l; j++) { Behavior.behaviors[composition.ids[j]].RemoveElement(id); } l = composition.delegates.Count; for (var j = 0; j < l; j++) { composition.delegates[j](false); } } if (ProcessingSignals.TryRemoveGlobal(this)) { signals?.Remove(this); } ProcessingUpdate.Default.Remove(this); HandleDisable(); }
protected override void HandleReturnToPool() { ClearTagsAll(); ProcessingEntities.Default.CheckGroups(id, false); var len = compositionNoTags.Count; int i; for (i = 0; i < len; i++) { Behavior.behaviors[compositionNoTags[i]].RemoveElement(id); } len = compositions != null ? compositions.Count : -1; for (i = 0; i < len; i++) { var composition = compositions[i]; composition.changed = false; var l = composition.ids.Count; for (var j = 0; j < l; j++) { Behavior.behaviors[composition.ids[j]].RemoveElement(id); } l = composition.delegates.Count; for (var j = 0; j < l; j++) { composition.delegates[j](false); } } if (ProcessingSignals.TryRemoveGlobal(this)) { signals?.Remove(this); } ProcessingUpdate.Default.Remove(this); // len = compositions != null ? compositions.Count : -1; // // for (i = 0; i < len; i++) // { // compositions[i].changed = false; // } base.HandleReturnToPool(); }
protected void OnDestroy() { if (Toolbox.isQuittingOrChangingScene()) { return; } prevID.Push(id); ProcessingEntities.Default.CheckGroups(id, false); var len = compositionNoTags.Count; int i; for (i = 0; i < len; i++) { Behavior.behaviors[compositionNoTags[i]].RemoveElement(id); } len = compositions != null ? compositions.Count : -1; for (i = 0; i < len; i++) { var composition = compositions[i]; var l = composition.ids.Count; for (var j = 0; j < l; j++) { Behavior.behaviors[composition.ids[j]].RemoveElement(id); } composition.delegates.Clear(); } if (ProcessingSignals.TryRemoveGlobal(this)) { signals?.Remove(this); } ProcessingUpdate.Default.Remove(this); compositionNoTags.Clear(); compositions.Clear(); tags?.Clear(); signals?.Dispose(); signals = null; }
public virtual void OnDisable() { if (Toolbox.isQuittingOrChangingScene() || !state.enabled) { return; } state.enabled = false; if (ProcessingSignals.TryRemoveGlobal(this)) { signals?.Remove(this); } ProcessingUpdate.Default.Remove(this); HandleDisable(); }
protected void BindSignals() { signals = new ProcessingSignals(); }
protected ProcessingBase() { ProcessingSystemAttributes.Setup(this); ProcessingGroupAttributes.Setup(this); ProcessingSignals.TryAddToGlobal(this); }
public override void OnEnable() { if (state.enabled || state.requireStarter || state.requireActorParent) { return; } if (state.disabled) { ProcessingEntities.Default.CheckGroups(id, true); } HandleEnable(); state.released = false; state.disabled = false; state.enabled = true; if (ProcessingSignals.TryAddToGlobal(this)) { if (signals == null) { signals = new ProcessingSignals(); } signals.Add(this); } var len = compositionNoTags.Count; int i; for (i = 0; i < len; i++) { Behavior.behaviors[compositionNoTags[i]].AddElement(id); } len = compositions != null ? compositions.Count : -1; for (i = 0; i < len; i++) { var composition = compositions[i]; if (composition.changed || !composition.Contain(tags)) { continue; } composition.changed = true; var l = composition.ids.Count; for (var j = 0; j < l; j++) { Behavior.behaviors[composition.ids[j]].AddElement(id); } l = composition.delegates.Count; for (var j = 0; j < l; j++) { composition.delegates[j](true); } } ProcessingUpdate.Default.Add(this); }