public static void TriggerEvent(EventType type) { if (!Application.isPlaying) { FindAllModifiers(); } GraphModifier root = GraphModifier.root; switch (type) { case EventType.PostScan: while (root != null) { root.OnPostScan(); root = root.next; } return; case EventType.PreScan: while (root != null) { root.OnPreScan(); root = root.next; } return; case EventType.LatePostScan: while (root != null) { root.OnLatePostScan(); root = root.next; } return; case EventType.PreUpdate: while (root != null) { root.OnGraphsPreUpdate(); root = root.next; } return; case EventType.PostUpdate: while (root != null) { root.OnGraphsPostUpdate(); root = root.next; } return; case EventType.PostCacheLoad: while (root != null) { root.OnPostCacheLoad(); root = root.next; } return; } }
protected virtual void OnEnable() { this.OnDisable(); if (root == null) { root = this; } else { this.next = root; root.prev = this; root = this; } }
protected virtual void OnDisable() { if (root == this) { root = this.next; if (root != null) { root.prev = null; } } else { if (this.prev != null) { this.prev.next = this.next; } if (this.next != null) { this.next.prev = this.prev; } } this.prev = null; this.next = null; }