Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
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();
            }
        }