コード例 #1
0
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            InputManager.Update();
            Time.Update(gameTime);

            GameObject3d.UpdateObjects();

            while (terrainRenderer.lastRowDepth < camera.Transform.Position.Z - 5)
            {
                terrainRenderer.updateNormals(Math.Abs(terrainRenderer.lastRowDepth - 5), Vector3.Up);
                terrainRenderer.updateDepth(terrainRenderer.lastRowDepth);
                terrainRenderer.updateNormals(terrainRenderer.lastRowDepth + 1, Vector3.Down);
            }

            terrainRenderer.songPos = (float)waveOut.GetPosition() / (float)reader.Length;
            if (terrainRenderer.songPos < 1)
            {
                terrainRenderer.avgE = 1 / (float)(avgE[(int)(avgE.Length * terrainRenderer.songPos)] - 100);
            }

            if (!songStarted && terrainRenderer.lastRowDepth > 100)
            {
                songStarted = true;
                newHoop();
                waveOut.Play();
            }

            if (InputManager.IsKeyPressed(Keys.T))
            {
                postToggle = !postToggle;
            }
            if (InputManager.IsKeyPressed(Keys.N))
            {
                noisyToggle = !noisyToggle;
            }
            if (InputManager.IsKeyPressed(Keys.F))
            {
                GameScreenManager.graphics.ToggleFullScreen();
            }

            if (InputManager.IsKeyDown(Keys.Up))
            {
                camera.FieldOfView += 0.01f;
            }
            if (InputManager.IsKeyDown(Keys.Down))
            {
                camera.FieldOfView -= 0.01f;
            }

            if (!noisyToggle)
            {
                updateCam();
            }

            checkSongEnding();
            //pos.Y += terrainRenderer.avgE;
            //terrainRenderer.totalFrames = mp3Frames.Count();
        }