Ejemplo n.º 1
0
        void Update()
        {
            Instance = this;

            Tweener.Tweener.Update(DeltaTime);
            if (Coroutine.Running)
            {
                Coroutine.Update();
            }
            Coroutine.Instance = Coroutine;
            UpdateScenes();
            foreach (var session in Sessions)
            {
                session.Update();
            }
            if (Scene != null)
            {
                Scene.UpdateLists();
                Scene.UpdateFirstInternal();
                Scene.UpdateInternal();
                Scene.UpdateLastInternal();
                //Scene.UpdateLists(); // Remove no longer happens instantaneously.
                GameFrames++;
            }

            updatedOnce = true;
            Timer      += DeltaTime;
        }
Ejemplo n.º 2
0
        void UpdateScenes()
        {
            if (goToScene == null)
            {
                if (removeSceneCount > 0)
                {
                    for (int i = 0; i < removeSceneCount; i++)
                    {
                        Scenes.Pop().EndInternal();
                        if (Scene != null)
                        {
                            Scene.ResumeInternal();
                        }
                    }
                    removeSceneCount = 0;
                }
                if (goToScenes.Count > 0)
                {
                    for (int i = 0; i < goToScenes.Count; i++)
                    {
                        if (Scene != null)
                        {
                            Scene.PauseInternal();
                        }
                        Scenes.Push(goToScenes[i]);
                        goToScenes[i].Game = this;
                        goToScenes[i].BeginInternal();
                        goToScenes[i].UpdateLists();
                        if (i < goToScenes.Count - 1)
                        {
                            goToScenes[i].Update();
                        }
                    }
                    goToScenes.Clear();
                }
            }
            else
            {
                if (Scene != null)
                {
                    Scene.EndInternal();
                }
                Scenes.Clear();
                Scenes.Push(goToScene);
                Scene.Game = this;
                Scene.UpdateLists();
                Scene.BeginInternal();

                goToScene = null;
            }
        }