Exemplo n.º 1
0
        private void UpdateGameState()
        {
            switch (currentGameState)
            {
                case GameState.Start:
                    // Wait until the player presses "Enter" to start the first level
                    if (Keyboard.GetState().IsKeyDown(Keys.Enter))
                    {
                        if (!videoPlaying)
                        {
                            audio.PlayCue("stateTransition");
                            audio.PlayBackgroundMusic("DigitalStream");

                            videoPlayer.Play(video);
                            videoPlaying = true;
                        }
                    }

                    UpdateVideo();
                    break;

                case GameState.Play:
                    UpdateLevelState();
                    break;
                
                case GameState.End:
                    break;
                
                default:
                    throw new NotImplementedException("Invalid game state!");
            }
        }
Exemplo n.º 2
0
        private void CreateLaserBeam()
        {
            Model laserBeamModel = Game.Content.Load <Model>(@"Models\Weapons\laserbeam");

            laserBeam = new LaserBeam(laserBeamModel, camera);
            audio.PlayCue("laser");
        }
Exemplo n.º 3
0
 private void CheckShipCollisions()
 {
     // Check for collisions with the ship
     for (int i = 0; i < ASTEROID_COUNT; i++)
     {
         if (asteroids[i].Collides(ship))
         {
             audio.PlayCue("flashbang");
             ship.col = new Vector3(1, 0, 0);
             status   = "HIT!";
             Explode  = true;
             ship.damage_count++;
             times_hit++;
         }
     }
 }
Exemplo n.º 4
0
        //Shake Camera
        private void ShakeCamera(Camera camera)
        {
            int[] millsecondOffsets = { 50, 75, 100, 125, 150, 175 };

            for (int i = 0; i < SHAKE_COUNT; i++)
            {
                int millisecondOffset = millsecondOffsets[i];
                UpdateShake(millisecondOffset);
            }

            if ((milliseconds > (previousMilliseconds + 200) && test))
            {
                audio.PlayCue("explosion");

                camera.Direction = tempDirection;
                camera.Position  = tempPosition;
                camera.Up        = tempUp;

                camera.Yaw   = tempYaw;
                camera.Pitch = tempPitch;
                camera.Roll  = tempRoll;

                test      = false;
                isShaking = false;
                shake[0]  = false;
            }
        }