/** Triggers an event for all active graph modifiers */ public static void TriggerEvent (GraphModifier.EventType type) { if (!Application.isPlaying) { FindAllModifiers (); } GraphModifier c = root; switch (type){ case EventType.PreScan: while (c != null) { c.OnPreScan(); c = c.next; } break; case EventType.PostScan: while (c != null) { c.OnPostScan(); c = c.next; } break; case EventType.LatePostScan: while (c != null) { c.OnLatePostScan(); c = c.next; } break; case EventType.PreUpdate: while (c != null) { c.OnGraphsPreUpdate(); c = c.next; } break; case EventType.PostUpdate: while (c != null) { c.OnGraphsPostUpdate(); c = c.next; } break; case EventType.PostCacheLoad: while (c != null) { c.OnPostCacheLoad(); c = c.next; } break; } }
/** Removes this modifier from list of active modifiers */ protected virtual void OnDisable () { if (root == this) { root = next; if (root != null) root.prev = null; } else { if (prev != null) prev.next = next; if (next != null) next.prev = prev; } prev = null; next = null; }
/** Adds this modifier to list of active modifiers. */ protected virtual void OnEnable () { OnDisable(); if (root == null) { root = this; } else { next = root; root.prev = this; root = this; } }