コード例 #1
0
    public override void Update(GameTime gameTime)
    {
        if (state_ != camera_.CurrentCamera.State)
        {
            state_ = camera_.CurrentCamera.State;
            defaultCategory.SetVolume(50);
            switch (state_)
            {
            case CameraState.Chase:
                cameraCue = soundBank.GetCue("chase");
                cameraCue.Play();
                break;

            case CameraState.Reverse:
                cameraCue = soundBank.GetCue("reverse");
                cameraCue.Play();
                break;

            case CameraState.Dynamic:
                cameraCue = soundBank.GetCue("dynamic");
                cameraCue.Play();
                break;

            case CameraState.TopDown:
                cameraCue = soundBank.GetCue("top_down");
                cameraCue.Play();
                break;
            }
        }

        for (int i = 0; i < cueArray.Length; i++)
        {
            cueArray[i].Apply3D(listener_, CarSoundEmitters.AudioEmitters[i]);
        }

        if (car_.LinearVelocity.LengthSquared() <= 400)
        {
            musicCategory.SetVolume(car_.LinearVelocity.LengthSquared() / 16);
        }
        else if (car_.LinearVelocity.LengthSquared() > 1650)
        {
            musicCategory.SetVolume(0);
        }
        else
        {
            musicCategory.SetVolume(25);
        }

        base.Update(gameTime);
    }
コード例 #2
0
        private void setVoiceVolume(EventArgs e)
        {   // Set the category volume.
            float temp = 2.0f * (SoundManager.getVoiceVolume() / 100.0f);

            voiceCategory.SetVolume(temp);
            // System.Diagnostic.Debug.WriteLine(temp);
        }
コード例 #3
0
ファイル: AudioManager.cs プロジェクト: alphamond0/mono-PPAI
        public AudioManager(Game game, String AudioEnginePath, String SoundBankPath, String SE_WaveBankPath, String BGM_WaveBankPath)
            : base(game)
        {
            DefaultAudioEnginePathValues = false;

            _aEnginePath2     = AudioEnginePath;
            _aSoundBankPath2  = SoundBankPath;
            _seWaveBankPath2  = SE_WaveBankPath;
            _bgmWaveBankPath2 = BGM_WaveBankPath;

            try
            {
                _audioEngine = new AudioEngine(_aEnginePath2);
                _aSoundBank  = new SoundBank(_audioEngine, _aSoundBankPath2);
                _seWaveBank  = new WaveBank(_audioEngine, _seWaveBankPath2);
                _bgmWaveBank = new WaveBank(_audioEngine, _bgmWaveBankPath2, 0, 16);
            }
            catch (NoAudioHardwareException)
            {
                _audioEngine = null;
                _aSoundBank  = null;
                _seWaveBank  = null;
                _bgmWaveBank = null;
            }

            _seCategory  = _audioEngine.GetCategory("SE");
            _bgmCategory = _audioEngine.GetCategory("BGM");

            _seCategory.SetVolume(_seVolume);
            _bgmCategory.SetVolume(_bgmVolume);

            _gameRef = game;
            _AudMan  = this;
        }
コード例 #4
0
        /// <summary>
        /// Update gear volume and pitch
        /// </summary>
        /// <param name="gearSound">Gear sound</param>
        /// <param name="volume">Volume</param>
        /// <param name="pitch">pitch</param>
        private static void UpdateGearVolumeAndPitch(
            string gearSound, float volume, float pitch)
        {
            if (audioEngine == null)
            {
                return;
            }

            // Gear changing in progress?
            if (gearChangeSoundInitiatedMs > 0)
            {
                gearChangeSoundInitiatedMs -=
                    BaseGame.ElapsedTimeThisFrameInMilliseconds;
                // If gear change sound ends in this frame (max time - frameMs),
                // then start gear sound!
                if (gearChangeSoundInitiatedMs <= 0)
                {
                    gearChangeSoundInitiatedMs = 0;
                    PlayGearSound(gearSound);
                    volume = lastGearVolume = 1.0f;
                    pitch  = lastGearPitch = -0.3f;
                }
            }

            // Set the global volume for this category
            gearsCategory.SetVolume(MathHelper.Clamp(volume, 0, 1) *
                                    GameSettings.Default.SoundVolume);

            // Set pitch only if this is a gear sound
            if (currentGearCue != null)
            {
                currentGearCue.SetVariable("Pitch",
                                           55 * MathHelper.Clamp(pitch, -1, 1));
            }
        }
コード例 #5
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load content belonging to the screen manager.
            ContentManager content = Game.Content;

            spriteBatch      = new SpriteBatch(GraphicsDevice);
            font             = content.Load <SpriteFont>("menufont");
            blankTexture     = content.Load <Texture2D>("blank");
            screenInCounter  = 0;
            originalViewport = GraphicsDevice.Viewport;
            audioEngine      = new AudioEngine("Content\\Sounds.xgs");
            soundBank        = new SoundBank(audioEngine, "Content\\SoundBank.xsb");
            waveBank         = new WaveBank(audioEngine, "Content\\WaveBank.xwb", 0, 64);
            while (!waveBank.IsPrepared)
            {
                audioEngine.Update();
            }
            musicCategory = audioEngine.GetCategory("Music");
            musicCategory.SetVolume(1);
            shipchosenBool1     = false;
            shipchosenBool2     = false;
            currentShipChoosing = 1;
            mainMenu            = soundBank.GetCue("MainMenu");
            mainMenu.Play();
            // Tell each of the screens to load their content.
            foreach (GameScreen screen in screens)
            {
                screen.Activate(false);
            }
        }
コード例 #6
0
        }         // PlayItemSound(itemType)

        /// <summary>
        /// Play rocket motor sound
        /// </summary>
        /// <param name="volume">Volume</param>
        public static void PlayRocketMotorSound(float volume)
        {
            // Get new cue everytime this is called, else we get Xact throwing this:
            // The method or function called cannot be used in the manner requested.
            rocketMotorSound = soundBank.GetCue(Sounds.RocketMotor.ToString());
            rocketMotorSound.Play(); //.PlayLooped();
            motorCategory.SetVolume(0.86f);
        }                            // PlayRocketMotorSound(volume)
コード例 #7
0
 public static void SetVolumes(float soundVolume, float musicVolume)
 {
     if (audioEngine != null)
     {
         // Update sound volumes
         defaultCategory.SetVolume(soundVolume);
         musicCategory.SetVolume(musicVolume);
         // Volume of gears is updated each frame
     }
 }
コード例 #8
0
        public override void Initialize()
        {
            //Categories
            m_musicCategory = m_engine.GetCategory(s_musicCategory);
            m_soundCategory = m_engine.GetCategory(s_soundCategory);

            //Set the volumes
            m_musicCategory.SetVolume(Settings.Default.MusicVolume);
            m_soundCategory.SetVolume(Settings.Default.SoundVolume);
        }
コード例 #9
0
ファイル: Song.cs プロジェクト: tbeaupre/SpaceCadet
        public void UpdateMusic()
        {
            switch (musicDynamic)
            {
            case 0:
                track1 = 0.0f;
                track2 = 0.0f;
                track3 = 0.0f;
                break;

            case 1:
                track1 = 5.0f;
                track2 = 0.0f;
                track3 = 0.0f;
                break;

            case 2:
                track1 = 5.0f;
                track2 = 5.0f;
                track3 = 0.0f;
                break;

            case 3:
                track1 = 5.0f;
                track2 = 5.0f;
                track3 = 5.0f;
                break;

            case 4:
                track1 = 0.0f;
                track2 = 0.0f;
                track3 = 5.0f;
                break;

            case 5:
                track1 = 0.0f;
                track2 = 5.0f;
                track3 = 5.0f;
                break;

            default:
                track1 = 0.0f;
                track2 = 1.0f;
                track3 = 0.0f;
                break;
            }
            engine.Update();
            firstCat = engine.GetCategory(cue1);
            firstCat.SetVolume(track1);
            secondCat = engine.GetCategory(cue2);
            secondCat.SetVolume(track2);
            thirdCat = engine.GetCategory(cue3);
            thirdCat.SetVolume(track3);
        }
コード例 #10
0
ファイル: SLAudio.cs プロジェクト: thakgit/StiLib
        /// <summary>
        /// Sets the volume of a catagory
        /// </summary>
        /// <param name="categoryName"></param>
        /// <param name="volume">[0, 1]</param>
        public void SetVolume(string categoryName, float volume)
        {
            if (!isInitialized)
            {
                MessageBox.Show("Audio System Not Initialized !", "Error !");
            }

            AudioCategory category = GetCategory(categoryName);

            categories[categoryName] = volume;
            category.SetVolume(volume * globalVolume);
        }
コード例 #11
0
        private static void SetSoundVolume()
        {
            float adjustedVolume = (float)options.soundVolume / 10.0f;

            try
            {
                SoundCategory.SetVolume(adjustedVolume);
            }
            catch
            {
            }
        }
コード例 #12
0
        private static void SetMusicVolume()
        {
            float adjustedVolume = (float)options.musicVolume / 10.0f;

            try
            {
                MusicCategory.SetVolume(adjustedVolume);
            }
            catch
            {
            }
        }
コード例 #13
0
        /// <summary>
        /// Sets the volume of a catagory
        /// </summary>
        /// <param name="volume">Between 0 and 1, where 0 is mute.</param>
        public void SetVolume(string categoryName, float volume)
        {
            if (!isInitialized)
            {
                throw new Exception("Audio system must be initialized.");
            }

            //volume = MathHelper.Clamp(volume, 0, 1);
            AudioCategory category = GetCategory(categoryName);

            categoryVolumes[category] = volume;
            category.SetVolume(volume * globalVolume);
        }
コード例 #14
0
        /** @fn     void Init()
         *  @brief  initialize the sounds
         */
        public void Init(ContentManager content)
        {
            //m_audioEngine = content.Load< AudioEngine >( SOUND_DIRECTORY + "GameSound" );
            m_audioEngine = new AudioEngine(SOUND_DIRECTORY + "GameSound.xgs");
            m_soundBank   = new SoundBank(m_audioEngine, SOUND_DIRECTORY + "Sound Bank.xsb");
            m_waveBank    = new WaveBank(m_audioEngine, SOUND_DIRECTORY + "Wave Bank.xwb");

            m_acMusic  = m_audioEngine.GetCategory("Music");
            m_acSounds = m_audioEngine.GetCategory("Sounds");

            m_acMusic.SetVolume(m_fMusicVolume * m_fTotalVolume);
            m_acSounds.SetVolume(m_fSoundVolume * m_fTotalVolume);
        }
コード例 #15
0
ファイル: Audio.cs プロジェクト: bradleat/trafps
        public float ChangeVolume(AudioCategory category, float volume, bool increase, float maxVolume)
        {
            if (increase)
            {
                volume = MathHelper.Clamp(volume + 0.01f, 0.0f, maxVolume);
            }
            else
            {
                volume = MathHelper.Clamp(volume - 0.01f, 0.0f, maxVolume);
            }

            category.SetVolume(volume);
            return(volume);
        }
コード例 #16
0
 //we can control the volume for each category in the sound bank (i.e. diegetic and non-diegetic)
 public void SetVolume(float newVolume, string soundCategoryStr)
 {
     try
     {
         AudioCategory soundCategory = this.audioEngine.GetCategory(soundCategoryStr);
         if (soundCategory != null)
         {
             //requested volume will be in appropriate range (0-1)
             this.volume = MathHelper.Clamp(newVolume, 0, 1);
             soundCategory.SetVolume(this.volume);
         }
     }
     catch (InvalidOperationException e)
     {
         System.Diagnostics.Debug.WriteLine(e.Message + ": Check that category (" + soundCategoryStr + ") exists in your Xact file?");
     }
 }
コード例 #17
0
ファイル: SoundManager.cs プロジェクト: cjjb95/SnowFront
 public void ChangeVolume(float deltaVolume, string soundCategoryStr)
 {
     try
     {
         AudioCategory soundCategory = this.audioEngine.GetCategory(soundCategoryStr);
         if (soundCategory != null)
         {
             //requested volume will be in appropriate range (0-1)
             this.volume = MathHelper.Clamp(this.volume + deltaVolume, 0, 1);
             soundCategory.SetVolume(this.volume);
         }
     }
     catch (InvalidOperationException e)
     {
         System.Diagnostics.Debug.WriteLine("Does category (soundCategoryStr) exist in your Xact file?");
     }
 }
コード例 #18
0
        public static void Initialize(Dictionary <string, string> parameters)
        {
            try
            {
                audioEngine = new AudioEngine(parameters["settingsFile"]);
                bgmBank     = new WaveBank(audioEngine, parameters["bgmBank"]);
                sfxBank     = new WaveBank(audioEngine, parameters["sfxBank"]);
                soundBank   = new SoundBank(audioEngine, parameters["soundBank"]);
            }
            catch (NoAudioHardwareException)
            {
                audioEngine = null;
                bgmBank     = null;
                sfxBank     = null;
                soundBank   = null;
            }
            sfxCategory = audioEngine.GetCategory(parameters["sfxCategory"]);
            bgmCategory = audioEngine.GetCategory(parameters["bgmCategory"]);

            sfxCategory.SetVolume(sfxVolume);
            bgmCategory.SetVolume(bgmVolume);
        }
コード例 #19
0
        /// <summary>
        /// Create sounds
        /// </summary>
        static Audio()
        {
            // Loading audio
            audioEngine = new AudioEngine("Content\\Audio\\DreamerAudio.xgs");
            waveBank    = new WaveBank(audioEngine, "Content\\Audio\\Wave Bank.xwb");
            soundBank   = new SoundBank(audioEngine, "Content\\Audio\\Sound Bank.xsb");



            musicCategory = audioEngine.GetCategory("Music");
            musicCategory.SetVolume(0.5f);

            dialogueCategory = audioEngine.GetCategory("Dialogue");


            // Get music cues
            backgroundMusic = soundBank.GetCue("GameBackgroundMusic");

            menuClick = soundBank.GetCue("MenuClick");

            endDialogue          = soundBank.GetCue("EndDialogue");
            introductionDialogue = soundBank.GetCue("IntroductionDialogue");

            heroDying1 = soundBank.GetCue("FranciscoHeroDying1");
            heroDying2 = soundBank.GetCue("FranciscoHeroDying2");

            attackingFlower1 = soundBank.GetCue("LukeAttackingFlower");
            attackingFlower2 = soundBank.GetCue("SarahAttackingFlower");
            attackingFlower3 = soundBank.GetCue("ShringiFlowerAttacking");
            attackingFlower4 = soundBank.GetCue("VolkanFlowerAttacking");

            dyingFlower1 = soundBank.GetCue("LukeDyingFlower");
            dyingFlower2 = soundBank.GetCue("SarahDyingFlower");
            dyingFlower3 = soundBank.GetCue("ShringiFlowerDying");
            dyingFlower4 = soundBank.GetCue("VolkanFlowerDying");
        }
コード例 #20
0
        /** @fn     void Update()
         *  @brief  update the sound manager - should be done once per frame
         */
        public void Update()
        {
            m_audioEngine.Update();

            ////////////////////////
            //Set the volumes
            m_acMusic.SetVolume(m_fMusicVolume * m_fTotalVolume);
            m_acSounds.SetVolume(m_fSoundVolume * m_fTotalVolume);

            //////////////////////
            //Replay looping sounds and delete finished sounds
            for (int i = 0; i < m_lstSoundsPlaying.Count; ++i)
            {
                SoundCue cue = m_lstSoundsPlaying[i];

                if (cue.IsPlaying == false)
                {
                    if (cue.LoopCount != 0)
                    {
                        SoundCue newCue = new SoundCue(m_soundBank.GetCue(cue.CueName));
                        newCue.LoopCount = cue.LoopCount - 1;

                        newCue.Play();

                        m_lstSoundsPlaying.RemoveAt(i);
                        i--;
                        m_lstSoundsPlaying.Add(newCue);
                    }
                    else //loop count IS 0
                    {
                        m_lstSoundsPlaying.RemoveAt(i);
                        --i;
                    }
                }
            }
        }
コード例 #21
0
 public void Initialize(IServiceProvider serviceProvider, Options options)
 {
     popUpText                   = new DrawableText();
     content                     = new ContentManager(serviceProvider, "Data");
     popUpText.font              = content.Load <SpriteFont>("Stuff\\Arial");
     popUpBG                     = content.Load <Texture2D>("Stuff\\popUpBG");
     popUpText.Text              = "";
     popUpText.color             = Color.White;
     this.options                = options;
     options.MusicVolumeChanged += new MusicVolumeChangedEventHandler(options_MusicVolumeChanged);
     options.ResolutionChanged  += new ResolutionChangedEventHandler(options_ResolutionChanged);
     audioEngine                 = new AudioEngine(GameConstants.AUDIO_PATH + "Music.xgs");
     waveBank                    = new WaveBank(audioEngine, GameConstants.AUDIO_PATH + "Music.xwb");
     soundBank                   = new SoundBank(audioEngine, GameConstants.AUDIO_PATH + "Music.xsb");
     menuCategory                = audioEngine.GetCategory("Music");
     graphXPackCategory          = menuCategory;
     menuCategory.SetVolume(options.MusicVolumeFloat);
     playList        = FileManager.GetFileDictString(GameConstants.MENU_PLAYLIST);
     currentPlaylist = playList;
     oldVolume       = options.MusicVolumeFloat;
     currentVolume   = options.MusicVolumeFloat;
     currentCategory = menuCategory;
     CreatePopUpRectangle(options.Resolution);
 }
コード例 #22
0
 public void Update(GameTime gameTime)
 {
     if (currentMusic == null)
     {
         currentMusic = soundBank.GetCue(GetRandomTrack(currentPlaylist));
         //Fake 3D Sound for Surround Effect ;)
         currentMusic.Apply3D(new AudioListener(), new AudioEmitter());
         currentMusic.Play();
         popUpText.Text = currentPlaylist[currentMusic.Name];
         StartPopUp();
     }
     if (currentMusic.IsStopped)
     {
         currentMusicindex++;
         if (currentMusicindex >= playList.Keys.Count)
         {
             currentMusicindex = 0;
         }
         currentMusic = soundBank.GetCue(GetRandomTrack(currentPlaylist));
         currentMusic.Apply3D(new AudioListener(), new AudioEmitter());
         currentMusic.Play();
         popUpText.Text = currentPlaylist[currentMusic.Name];
         StartPopUp();
     }
     if (transition)
     {
         oldVolume     -= gameTime.GetElapsedTotalSecondsFloat();
         oldVolume      = MathHelper.Clamp(oldVolume, 0, options.MusicVolumeFloat);
         currentVolume += gameTime.GetElapsedTotalSecondsFloat();
         if (currentVolume >= options.MusicVolumeFloat)
         {
             transition    = false;
             currentVolume = MathHelper.Clamp(currentVolume, 0, options.MusicVolumeFloat);
             oldCategory.Stop(AudioStopOptions.Immediate);
             oldMusic.Stop(AudioStopOptions.Immediate);
         }
         oldCategory.SetVolume(oldVolume);
         currentCategory.SetVolume(currentVolume);
     }
     if (popUpActive)
     {
         if (popUpFloatIn)
         {
             popUp.Y += (int)(popUpSpeed * gameTime.GetElapsedTotalSecondsFloat());
             AlignPopUpText();
             if (popUp.Y >= 0)
             {
                 popUpFloatIn = false;
             }
         }
         else
         {
             popUpStillStandelpasedTime += gameTime.GetElapsedTotalSecondsFloat();
             if (popUpStillStandelpasedTime >= popUpStillStandThreshold)
             {
                 popUp.Y -= (int)(popUpSpeed * gameTime.GetElapsedTotalSecondsFloat());
                 if (popUp.X <= -(int)(options.Resolution.ScreenHeight * 0.1))
                 {
                     popUpActive = false;
                 }
                 AlignPopUpText();
             }
         }
     }
 }
コード例 #23
0
        /// <summary>
        /// Allows each screen to run logic.
        /// </summary>
        public override void Update(GameTime gameTime)
        {
            // Read the keyboard and gamepad.
            input.Update();

            // Make a copy of the master screen list, to avoid confusion if
            // the process of updating one screen adds or removes others.
            tempScreensList.Clear();

            foreach (GameScreen screen in screens)
            {
                tempScreensList.Add(screen);
            }

            bool otherScreenHasFocus  = !Game.IsActive;
            bool coveredByOtherScreen = false;

            // Loop as long as there are screens waiting to be updated.
            while (tempScreensList.Count > 0)
            {
                // Pop the topmost screen off the waiting list.
                GameScreen screen = tempScreensList[tempScreensList.Count - 1];

                tempScreensList.RemoveAt(tempScreensList.Count - 1);

                // Update the screen.
                screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

                if (screen.ScreenState == ScreenState.TransitionOn ||
                    screen.ScreenState == ScreenState.Active)
                {
                    // If this is the first active screen we came across,
                    // give it a chance to handle input.
                    if (!otherScreenHasFocus)
                    {
                        screen.HandleInput(gameTime, input);

                        otherScreenHasFocus = true;
                    }

                    // If this is an active non-popup, inform any subsequent
                    // screens that they are covered by it.
                    if (!screen.IsPopup)
                    {
                        coveredByOtherScreen = true;
                    }
                }
            }

            if (audioEnabled == true)
            {
                musicCategory.SetVolume(audioVolume);
            }
            else
            {
                musicCategory.SetVolume(0);
            }

            // Print debug trace?
            if (traceEnabled)
            {
                TraceScreens();
            }
        }
コード例 #24
0
 public void SetSoundVolume(float volume)
 {
     soundVolume = volume;
     soundCategory.SetVolume(soundVolume);
 }
コード例 #25
0
 public void SetVolume(float volume)
 {
     audioCategory.SetVolume(volume);
 }
コード例 #26
0
ファイル: AudioManager.cs プロジェクト: otnemarcas/amude
 private void SetEffectsVolume()
 {
     effectsCategory.SetVolume(effectsVolume);
 }
コード例 #27
0
 /// <summary>
 /// default = 1.0f, 0.0f = silence
 /// </summary>
 /// <param name="volume"></param>
 /// <returns></returns>
 public void SetSoundVolume(float volume)
 {
     SoundCategory.SetVolume(volume);
 }
コード例 #28
0
 /// <summary>
 /// Default = 1.0f, 0.0f = silence
 /// </summary>
 /// <param name="volume"></param>
 public void SetMusicVolume(float volume)
 {
     MusicCategory.SetVolume(volume);
 }
コード例 #29
0
ファイル: AudioManager.cs プロジェクト: otnemarcas/amude
 private void SetMusicVolume()
 {
     musicCategory.SetVolume(musicVolume);
 }
コード例 #30
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                {
                    content = new ContentManager(ScreenManager.Game.Services, "Content");
                }

                topViewport    = ScreenManager.GraphicsDevice.Viewport;
                bottomViewport = ScreenManager.GraphicsDevice.Viewport;

                if (ScreenManager.ScreenHorizontal == true)
                {
                    topViewport.Height    = topViewport.Height / 2;
                    bottomViewport.Height = bottomViewport.Height / 2;
                    bottomViewport.Y      = topViewport.Height;

                    camera.AspectRatio = (float)ScreenManager.GraphicsDevice.Viewport.Width /
                                         (ScreenManager.GraphicsDevice.Viewport.Height / 2);
                    camera2.AspectRatio = (float)ScreenManager.GraphicsDevice.Viewport.Width /
                                          (ScreenManager.GraphicsDevice.Viewport.Height / 2);

                    camera.FieldOfView  = MathHelper.ToRadians(45);
                    camera2.FieldOfView = MathHelper.ToRadians(45);
                }
                else
                {
                    topViewport.Width    = topViewport.Width / 2;
                    bottomViewport.Width = bottomViewport.Width / 2;
                    bottomViewport.X     = topViewport.Width;

                    camera.AspectRatio = (float)(ScreenManager.GraphicsDevice.Viewport.Width / 2) /
                                         ScreenManager.GraphicsDevice.Viewport.Height;
                    camera2.AspectRatio = (float)(ScreenManager.GraphicsDevice.Viewport.Width / 2) /
                                          ScreenManager.GraphicsDevice.Viewport.Height;

                    camera.FieldOfView  = MathHelper.ToRadians(60);
                    camera2.FieldOfView = MathHelper.ToRadians(60);
                }

                gameFont    = content.Load <SpriteFont>("gamefont");
                rockModel   = content.Load <Model>("Rock");
                shipModel   = content.Load <Model>("SpaceShip1");
                shipModel2  = content.Load <Model>("SpaceShip2");
                groundModel = content.Load <Model>("Ground");
                cubeModel   = content.Load <Model>("cube");
                bulletModel = content.Load <Model>("Cone");
                skyBoxModel = content.Load <Model>("Space_SkyBox");
                audioEngine = ScreenManager.AudioEngine;
                soundBank   = ScreenManager.SoundBank;
                waveBank    = ScreenManager.WaveBank;
                acSFX       = audioEngine.GetCategory("SFX");
                acMusic     = audioEngine.GetCategory("Music");

                // Environmental Map Effect for Player 1
                envEffect1            = new EnvironmentMapEffect(ScreenManager.GraphicsDevice);
                envEffect1.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.PiOver4, ScreenManager.GraphicsDevice.Viewport.AspectRatio, 1.0f, 100.0f);
                envEffect1.View = Matrix.CreateLookAt(
                    new Vector3(2, 3, 32), Vector3.Zero, Vector3.Up);
                textureCube1 = new TextureCube(ScreenManager.GraphicsDevice, 256, false, SurfaceFormat.Color);
                Color[] facedata1 = new Color[256 * 256];
                for (int i = 0; i < 6; i++)
                {
                    envEffect1.Texture = content.Load <Texture2D>("skybox" + i.ToString());
                    envEffect1.Texture.GetData <Color>(facedata1);
                    textureCube1.SetData <Color>((CubeMapFace)i, facedata1);
                }
                envEffect1.Texture        = (shipModel.Meshes[0].Effects[0] as EnvironmentMapEffect).Texture;
                envEffect1.EnvironmentMap = textureCube1;
                envEffect1.EnableDefaultLighting();
                envEffect1.EnvironmentMapAmount   = 1.0f;
                envEffect1.FresnelFactor          = 1.0f;
                envEffect1.EnvironmentMapSpecular = Vector3.Zero;

                // Environmental Map Effect for Player 2
                envEffect2            = new EnvironmentMapEffect(ScreenManager.GraphicsDevice);
                envEffect2.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.PiOver4, ScreenManager.GraphicsDevice.Viewport.AspectRatio, 1.0f, 100.0f);
                envEffect2.View = Matrix.CreateLookAt(
                    new Vector3(2, 3, 32), Vector3.Zero, Vector3.Up);
                textureCube2 = new TextureCube(ScreenManager.GraphicsDevice, 256, false, SurfaceFormat.Color);
                Color[] facedata2 = new Color[256 * 256];
                for (int i = 0; i < 6; i++)
                {
                    envEffect2.Texture = content.Load <Texture2D>("skybox" + i.ToString());
                    envEffect2.Texture.GetData <Color>(facedata2);
                    textureCube2.SetData <Color>((CubeMapFace)i, facedata2);
                }
                envEffect2.Texture        = (shipModel2.Meshes[0].Effects[0] as EnvironmentMapEffect).Texture;
                envEffect2.EnvironmentMap = textureCube2;
                envEffect2.EnableDefaultLighting();
                envEffect2.EnvironmentMapAmount   = 1.0f;
                envEffect2.FresnelFactor          = 1.0f;
                envEffect2.EnvironmentMapSpecular = Vector3.Zero;

                //audioEngine = ScreenManager.AudioEngine;
                //soundBank = ScreenManager.SoundBank;
                //waveBank = ScreenManager.WaveBank;

                if (ScreenManager.AudioEnabled == true)
                {
                    acSFX.SetVolume(ScreenManager.SFXVolume);
                    acMusic.SetVolume(ScreenManager.AudioVolume);
                }
                else
                {
                    acSFX.SetVolume(0);
                    acMusic.SetVolume(0);
                }

                FxCue = soundBank.GetCue("ShotFx");
                //FxCue.Apply3D(shipListen1, shipEmit1);

                ship1Pos = new Vector3(10000, 350, 10000);
                ship2Pos = new Vector3(100, 350, 100);

                // Create shiplllllllllllllllllllllllllllll
                ship  = new Ship(ScreenManager.GraphicsDevice, ship1Pos, soundBank);
                ship2 = new Ship(ScreenManager.GraphicsDevice, ship2Pos, soundBank);
                //ship2.Position = new Vector3(100, 100, 100);

                RandomRockSpawner();

                UpdateCameraChaseTarget(ship, camera);
                UpdateCameraChaseTarget(ship2, camera2);

                camera.Reset();
                camera2.Reset();

                // A real game would probably have more content than this sample, so
                // it would take longer to load. We simulate that by delaying for a
                // while, giving you a chance to admire the beautiful loading screen.
                Thread.Sleep(1000);

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

#if WINDOWS_PHONE
            if (Microsoft.Phone.Shell.PhoneApplicationService.Current.State.ContainsKey("PlayerPosition"))
            {
                playerPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["PlayerPosition"];
                enemyPosition  = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["EnemyPosition"];
            }
#endif
        }