/// <summary> /// Removes an update receiver. /// </summary> /// <param name="updateAction">Update action to be removed.</param> /// <param name="renderAction">Render action to be removed.</param> /// <param name="root">Root scene of the update receiver.</param> public static void RemoveUpdateReceiver(Action updateAction, Action renderAction, SceneObject root) { var scenes = _instance._scenes; var scene = scenes.SingleOrDefault(x => x.Root == root); if (scene != null) { if (updateAction != null) { scene.UpdateReceiverOrder.Remove(updateAction); } if (renderAction != null) { scene.PreRenderReceiverOrder.Remove(renderAction); } } }
/// <summary> /// Registers an update receiver by sorting it into its scene root element. /// </summary> /// <param name="updateAction">Update action to call.</param> /// <param name="preRenderAction">Render action to call</param> /// <param name="root">Root scene of the update receiver.</param> /// <param name="order">Call order.</param> public static void RegisterUpdateReceiver(Action updateAction, Action preRenderAction, SceneObject root, int order = 0) { var scenes = _instance._scenes; var scene = scenes.SingleOrDefault(x => x.Root == root); if (scene == null) { scene = new SceneDescription { Root = root }; scenes.Add(scene); } if (updateAction != null) { scene.UpdateReceiverOrder[updateAction] = order; } if (preRenderAction != null) { scene.PreRenderReceiverOrder[preRenderAction] = order; } }