Exemple #1
0
        internal static void EditorUpdate(IEnumerable <GameObject> updateObjects, bool simulateGame, bool forceFixedStep)
        {
            isUpdating = true;
            Profile.TimeUpdate.BeginMeasure();

            Time.FrameTick(forceFixedStep, simulateGame);
            Profile.FrameTick();
            if (simulateGame)
            {
                VisualLog.UpdateLogEntries();
            }
            pluginManager.InvokeBeforeUpdate();
            if (simulateGame)
            {
                UpdateUserInput();
                Scene.Current.Update();

                foreach (GameObject obj in updateObjects)
                {
                    if (obj.ParentScene == Scene.Current)
                    {
                        continue;
                    }

                    obj.IterateComponents <ICmpUpdatable>(
                        l => l.OnUpdate(),
                        l => (l as Component).Active);
                }
            }
            else
            {
                Scene.Current.EditorUpdate();
                foreach (GameObject obj in updateObjects)
                {
                    obj.IterateComponents <ICmpUpdatable>(
                        l => l.OnUpdate(),
                        l => (l as Component).Active);
                }
            }
            sound.Update();
            pluginManager.InvokeAfterUpdate();
            VisualLog.PrepareRenderLogEntries();
            RunCleanup();

            Profile.TimeUpdate.EndMeasure();
            isUpdating = false;

            if (terminateScheduled)
            {
                Terminate();
            }
        }
        /// <summary>
        /// Performs a single update cycle.
        /// </summary>
        public static void Update()
        {
            isUpdating = true;
            Profile.TimeUpdate.BeginMeasure();

            Time.FrameTick();
            Profile.FrameTick();
            VisualLog.UpdateLogEntries();
            pluginManager.InvokeBeforeUpdate();
            UpdateUserInput();
            Scene.Current.Update();
            sound.Update();
            pluginManager.InvokeAfterUpdate();
            VisualLog.PrepareRenderLogEntries();
            RunCleanup();

            Profile.TimeUpdate.EndMeasure();
            isUpdating = false;

            if (terminateScheduled)
            {
                Terminate();
            }
        }