Пример #1
0
        internal static void FixedUpdateElements()
        {
            try
            {
                foreach (Module mod in Module._LoadedModules.ToArray())
                {
                    mod.FixedUpdate();
                }

                if (OnFixedUpdate != null)
                {
                    OnFixedUpdate.Invoke();
                }
            }
            catch (Exception e) { Log.Print("ERROR " + e.Message + Environment.NewLine + e.StackTrace); }
        }
Пример #2
0
        internal static void UpdateElements()
        {
            try
            {
                if (OnPreUpdate != null)
                {
                    OnPreUpdate.Invoke();
                }
                foreach (Module mod in Module._LoadedModules.ToArray())
                {
                    if (!mod.Enabled)
                    {
                        continue;
                    }
                    mod.PreUpdate();
                }
                OnUpdate?.Invoke();
                foreach (Module mod in Module._LoadedModules.ToArray())
                {
                    if (!mod.Enabled)
                    {
                        continue;
                    }
                    mod.Update();
                }
                OnPostUpdate?.Invoke();
                foreach (Module mod in Module._LoadedModules.ToArray())
                {
                    if (!mod.Enabled)
                    {
                        continue;
                    }
                    mod.PostUpdate();
                }
                OnEndUpdate?.Invoke();
                foreach (Module mod in Module._LoadedModules.ToArray())
                {
                    if (!mod.Enabled)
                    {
                        continue;
                    }
                    mod.EndUpdate();
                }

                foreach (Module mod in Module._LoadedModules.ToArray())
                {
                    if (!mod.Enabled)
                    {
                        continue;
                    }
                    mod.OnCameraRender();
                }
                OnPostRender?.Invoke();

                /*foreach (Module mod in Module._LoadedModules.ToArray())
                 * {
                 *  if (!mod.Enabled) continue;
                 *  mod.OnCameraRender();
                 * }*/

                Element._LoadedElements.AddRange(Element._SpawnNextFrame);
                Element._SpawnNextFrame = new List <Element>();

                Module._LoadedModules.AddRange(Module._LoadNextFrame);
                Module._LoadNextFrame = new List <Module>();


                Entry.ExecuteOnMainThread(() =>
                {
                    GameWindow.Instance.Render.Image = Camera.Main.RenderImage;
                    //Log.Print(Camera.Main.Malleable.Name);
                });
            }

            catch (Exception e) { Log.Print("ERROR " + e.Message + Environment.NewLine + e.StackTrace); }
        }