public GameState_MainMenu()
        {
            skyBox = new Skybox(
                GameMultiVerse.Instance.skyBoxTextures[new Random().Next(GameMultiVerse.Instance.skyBoxTextures.Length)],
                GameMultiVerse.skyboxSize,
                GameMultiVerse.Instance.Content);

            V = Matrix.CreateLookAt(Vector3.Zero, Vector3.One, Vector3.Up);
            P = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(GameMultiVerse.FOV),
                GameMultiVerse.Instance.GraphicsDevice.Viewport.AspectRatio,
                0.1f, GameMultiVerse.cameraViewDistance);

            MenuManager.Push(new MenuState_Main());
        }
Esempio n. 2
0
        public GameState_Play(string musicFile)
        {
            this.musicFile = musicFile;

            camera = new Camera_FollowShip();

            skyBox = new Skybox(
                GameMultiVerse.Instance.skyBoxTextures[new Random().Next(GameMultiVerse.Instance.skyBoxTextures.Length)],
                GameMultiVerse.skyboxSize,
                GameMultiVerse.Instance.Content);

            ship = new Ship();
            ship.moveSpd = gameSpd;
            ship.Position = new Vector3(0, 0, -ship.moveSpd * startCounterSecs + shipOffsetZ);

            prunnedSpectralFlux = new float[1];
            beatTimes = new float[1];
            SongUtils.Instance.PerformBeatDetection("MusicFiles/" + musicFile, false, ref prunnedSpectralFlux, ref beatTimes);

            GenerateObstacles();

            uint lengthInMs = SongUtils.Instance.GetLengthInMs("MusicFiles/" + musicFile);
            levelLength = gameSpd * ((float)lengthInMs / 1000);

            frequency = SongUtils.Instance.GetFrequency("MusicFiles/" + musicFile);

            // kezdeti beállítás, hogy a kamera a hajót kövesse
            GameTime stateStartTime = new GameTime(new TimeSpan(0), new TimeSpan(0));
            ship.Update(stateStartTime);
            camera.Update(stateStartTime, ship.Position);

            bgTexture = new Texture2D(GameMultiVerse.Instance.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            bgTexture.SetData(new[] { Color.White });

            pauseAction = delegate
                {
                    if (MenuManager.IsEmpty())
                    {
                        MenuManager.Push(new MenuState_Pause());
                    }
                    else
                    {
                        MenuManager.Pop();
                    }
                };
        }