コード例 #1
0
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     if (m_SceneChanges.ContainsKey(CurrentScene))
     {
         foreach (SceneChange sc in m_SceneChanges[CurrentScene])
         {
             if (sc.ChangeNow(gameTime))
             {
                 m_NextScene = sc.To;
                 if (CurrentScene != null)
                 {
                     CurrentScene.OnExit();
                     StopMainTune(m_NextScene);
                     CurrentScene.StopTune();
                 }
                 CurrentScene           = m_NextScene;
                 CurrentScene.StartTime = gameTime.TotalRealTime();
                 CurrentScene.Reset();
                 CurrentScene.OnEnter();
                 CurrentScene.StartTune();
                 StartMainTune();
             }
         }
     }
 }
コード例 #2
0
ファイル: SceneManager.cs プロジェクト: thismarvin/relatus
        private static void UpdateTransitions()
        {
            if (!transitionInProgress)
            {
                return;
            }

            if (!exitCompleted)
            {
                if (exitTransition == null)
                {
                    LoadNextScene();

                    enterTransition?.Begin();
                    exitCompleted = true;

                    if (enterTransition == null)
                    {
                        transitionInProgress = false;
                        exitCompleted        = false;
                    }
                }
                else
                {
                    exitTransition.Update();

                    if (exitTransition.Done)
                    {
                        CurrentScene.OnExit();

                        exitTransition.Reset();
                        exitTransition = null;

                        LoadNextScene();

                        enterTransition?.Begin();
                        exitCompleted = true;

                        if (enterTransition == null)
                        {
                            transitionInProgress = false;
                            exitCompleted        = false;
                        }
                    }
                }
            }
            else
            {
                enterTransition.Update();

                if (enterTransition.Done)
                {
                    enterTransition.Reset();
                    enterTransition = null;

                    transitionInProgress = false;
                    exitCompleted        = false;
                }
            }
        }
コード例 #3
0
ファイル: Game.cs プロジェクト: Patch095/SpaceShooter
        public static void Play()
        {
            //scenesCreation
            TitleScene aivTitle = new TitleScene("Assets/aivBG.png", KeyCode.Return);
            WelcomeScene welcome = new WelcomeScene("Assets/welcomeBg.jpg", KeyCode.Return);
            PlayScene playScene = new PlayScene();
            GameOverScene gameover = new GameOverScene();
            //scenes config
            aivTitle.NextScene = welcome;
            aivTitle.ShowTime = 3;
            aivTitle.FadeIn = true;
            aivTitle.FadeOut = true;

            welcome.NextScene = playScene;
            welcome.FadeOut = false;

            playScene.NextScene = gameover;
            gameover.NextScene = playScene;

            aivTitle.Start();
            CurrentScene = aivTitle;

            //GfxManager.Load();
            while (Window.opened)
            {
                if (!CurrentScene.IsPlaying)
                {
                    //next scene
                    if (CurrentScene.NextScene != null)
                    {
                        CurrentScene.OnExit();
                        CurrentScene = CurrentScene.NextScene;
                        CurrentScene.Start();
                    }
                    else
                        return;
                }

                //Input
                if (Window.GetKey(KeyCode.Esc))
                    break;
                CurrentScene.Input();

                //Update
                CurrentScene.Update();

                //Draw
                CurrentScene.Draw();

                Window.Update();
            }
        }
コード例 #4
0
 public void SetScene(Scene newScene)
 {
     if (CurrentScene != null)
     {
         CurrentScene.OnExit();
     }
     CurrentScene = newScene;
     if (CurrentScene != null)
     {
         CurrentScene.OnEnter(CurrentScene.FirstTime);
         CurrentScene.FirstTime = false;
     }
 }
コード例 #5
0
        public static void Play()
        {
            while (window.opened)
            {
                AudioManager.SetStreamingMusic("intro", 0.5f);
                //backGround.Stream(intro, window.deltaTime); //audio background



                if (!CurrentScene.IsPlaying)
                {
                    //next scene
                    if (CurrentScene.NextScene != null)
                    {
                        CurrentScene.OnExit();
                        CurrentScene = CurrentScene.NextScene;
                        CurrentScene.Start();
                    }
                    else
                    {
                        return;
                    }
                }

                //totalTime += GfxTools.Win.deltaTime;
                Console.SetCursorPosition(0, 0);
                //float fps = 1 / window.deltaTime;
                //if(fps<59)
                //    Console.Write((1 / window.deltaTime) + "                   ");

                //Input
                if (window.GetKey(KeyCode.Esc))
                {
                    break;
                }

                CurrentScene.Input();

                //Update
                CurrentScene.Update();

                //Draw
                CurrentScene.Draw();

                window.Update();
            }
        }
コード例 #6
0
        public static void Play()
        {
            while (window.opened)
            {
                if (!CurrentScene.IsPlaying)
                {
                    //next scene
                    if (CurrentScene.NextScene != null)
                    {
                        CurrentScene.OnExit();
                        CurrentScene = CurrentScene.NextScene;
                        CurrentScene.Start();
                    }
                    else
                    {
                        return;
                    }
                }

                //totalTime += GfxTools.Win.deltaTime;
                //Console.SetCursorPosition(0, 0);
                //Console.Write((1 / window.deltaTime)+"                   ");

                //Input
                if (window.GetKey(KeyCode.Esc))
                {
                    break;
                }

                CurrentScene.Input();

                //Update
                CurrentScene.Update();

                //Draw
                CurrentScene.Draw();

                window.Update();
            }
        }