public void AddNewSound(string cueName)
        {
            Cue cue = AEM.soundBank.GetCue(cueName);

            cue.Play();
            playedSounds.Add(cue);
        }
        protected override void Update(GameTime gameTime)
        {
            GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);

            if (gamePadState.Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            MouseState    mouseState = Mouse.GetState();
            KeyboardState keyState   = Keyboard.GetState();

            fpsCam.Update(mouseState, keyState, gamePadState);

            float   time        = (float)gameTime.TotalGameTime.TotalMilliseconds / 1000.0f;
            Vector3 startingPos = new Vector3(0, 0, -10);
            Matrix  rotMatrix   = Matrix.CreateRotationY(time);

            modelPos = Vector3.Transform(startingPos, rotMatrix);

            UpdateSoundPosition(cue1, modelPos, fpsCam.Position, fpsCam.Forward, fpsCam.UpVector);

            if (cue1.IsPrepared)
            {
                cue1.Play();
            }

            audioEngine.Update();

            base.Update(gameTime);
        }
Exemplo n.º 3
0
        public void PlaySong(string name)
        {
            Cue c = sounds.GetCue(name);

            songs.Add(name, c);
            c.Play();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Plays a sound
        /// </summary>
        /// <param name="cueName">Which sound to play</param>
        /// <returns>XACT cue to be used if you want to stop this particular looped
        /// sound. Can be ignored for one shot sounds</returns>
        public Cue Play(string cueName)
        {
            Cue returnValue = soundbank.GetCue(cueName);

            returnValue.Play();
            return(returnValue);
        }
Exemplo n.º 5
0
        public static Cue PlaySound(string soundName)
        {
            Cue sound = instance.soundBank.GetCue(soundName);

            sound.Play();
            return(sound);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Plays a sound
        /// </summary>
        /// <param name="sound">Which sound to play</param>
        /// <returns>XACT cue to be used if you want to stop this particular looped sound. Can NOT be ignored.  If the cue returned goes out of scope, the sound stops!!</returns>
        public static Cue Play(Sounds sound)
        {
            Cue returnValue = soundbank.GetCue(cueNames[(int)sound]);

            returnValue.Play();
            return(returnValue);
        }
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            if (welcome)
            {
                if (welcomeCue.IsStopped)
                {
                    bgCue.Play();
                    welcome = false;
                }
            }

            GUIManager.Instance.DrawTexture(this.backgroundTexture, Vector2.Zero, 1.0f, this.invertedAspectRatio);
            GUIManager.Instance.DrawText(this.font, "11 - DEATH TV", this.channelPos, this.normalColor);
            GUIManager.Instance.DrawTexture(this.logoTexture, this.logoOnePos, 0.05f, 0.07f);
            GUIManager.Instance.DrawTexture(this.logoTexture, this.logoTwoPos, 0.05f, 0.07f);
            GUIManager.Instance.DrawText(this.font, "TRASH SOUP", this.namePos, Color.Red);

            if (this.menuState == MenuStateEnum.MainMenu)
            {
                this.DrawMainMenu();
            }
            else if (this.menuState == MenuStateEnum.Credits)
            {
                this.DrawCredits();
            }
        }
Exemplo n.º 8
0
        public Cue PlaySound(string soundName)
        {
            Cue result = GetCue(soundName);

            result.Play();
            return(result);
        }
Exemplo n.º 9
0
        protected override void Initialize()
        {
            // Game Menu
            menu = new Menu();
            MenuItem newGame    = new MenuItem("Новая Игра");
            MenuItem resumeGame = new MenuItem("Продолжить");
            MenuItem exitGame   = new MenuItem("Выход");

            resumeGame.Active = false;

            newGame.Click    += new EventHandler(newGame_Click);
            resumeGame.Click += new EventHandler(resumeGame_Click);
            exitGame.Click   += new EventHandler(exitGame_Click);

            this.IsMouseVisible = true;

            menu.Items.Add(newGame);
            menu.Items.Add(resumeGame);
            menu.Items.Add(exitGame);


            // Audio Engine Initialize
            engine    = new AudioEngine("Content\\test.xgs");
            waveBank  = new WaveBank(engine, "Content\\Wave Bank.xwb");
            soundBank = new SoundBank(engine, "Content\\Sound Bank.xsb");

            music = soundBank.GetCue("music");
            music.Play();

            base.Initialize();
        }
Exemplo n.º 10
0
        public void Update(GameTime gameTime)
        {
            GameState gs = ResourceMgr.Instance.Game.State;

            if (gs == GameState.RUNNING && !ISOVER)
            {
                Cue c = ResourceMgr.Instance.Game.ActiveMusic;
                if (c.IsPrepared)
                {
                    c.Play();
                }

                tabuleiro.Update(gameTime);
                _surface.Update(gameTime);

                if (Player.Instance.CurrentMissionPoints >= maxScore)
                {
                    ResourceMgr.Instance.Game.State = GameState.MISSION_END;
                    Statistics.Instance.RemainingPiecesAt(ResourceMgr.Instance.Game.Board.NumPieces);
                    HUD.Instance.RemoveAllMessages();
                    Text3DManager.Instance.ClearAllTexts();
                    return;
                }
            }
            if (gs == GameState.MISSION_END)
            {
                tabuleiro.UpdateAfterEnd(gameTime);
                _surface.Update(gameTime);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Plays a sound immediately
        /// </summary>
        /// <param name="soundName">The name of the sound in the XACT project</param>
        /// <param name="soundBankFile">The name of the sound bank to retrieve the sound from</param>
        #endregion
        public static Cue PlaySound(String soundName, string soundBankFile)
        {
            Cue soundCue = null;

            try
            {
                soundCue = mXnaSoundBanks[soundBankFile].GetCue(soundName);

                //NM: Wait for the sound to be preapred if necessary
                //I have timed this and the time to prepare is negligible and it ensures the song will actually play and not just fail silently.
                while (!soundCue.IsPrepared)
                {
                    mXnaAudioEngine.Update();
                }

                soundCue.Play();
            }
            catch (IndexOutOfRangeException e)
            {
                throw new IndexOutOfRangeException(
                          "\"" + soundName + "\" is not a cue name in the specified sound bank.",
                          e);
            }
            catch (KeyNotFoundException e)
            {
                throw new KeyNotFoundException(
                          "The sound bank \"" + soundBankFile + "\" has not been loaded.  Did you forget to add the sound bank to the Audio Manager?",
                          e);
            }

            return(soundCue);
        }
Exemplo n.º 12
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            if (!backgroundMusic.IsPlaying)
            {
                backgroundMusic = AudioManager.BackgroundSoundBank.GetCue(backgroundMusic.Name);
                backgroundMusic.SetVariable("Volume", 4.0f);
                backgroundMusic.Play();
            }

            spriteBatch.Begin();
            switch (menu.DrawScreen)
            {
            case ScreenType.Game:
                level.Draw(spriteBatch);
                break;

            default:
                menu.Draw(spriteBatch);
                break;
            }
            spriteBatch.End();

            base.Draw(gameTime);
        }
Exemplo n.º 13
0
 public override void keyPressed(Keys key)
 {
     if (key == Keys.Left)
     {
         // Left arrow is pressed
         leftPressed = true;
         optionOver  = game.soundBank.GetCue("optionover");
         optionOver.Play();
     }
     else if (key == Keys.Right)
     {
         // Right arrow is pressed
         rightPressed = true;
         optionOver   = game.soundBank.GetCue("optionover");
         optionOver.Play();
     }
     else if (key == Keys.Enter)
     {
         // Select track
         optionSelected = game.soundBank.GetCue("optionselected");
         optionSelected.Play();
         GameState gameState = (GameState)game.states[Type.GAME];
         gameState.levelName = TrackManager.tracks[selectedTrack].filename;
         gameState.laps      = TrackManager.tracks[selectedTrack].laps;
         Log.log(Log.Type.INFO, "Time for this track: " + TrackManager.tracks[selectedTrack].time);
         gameState.totalTime = TrackManager.tracks[selectedTrack].time;
         game.changeState(Type.GAME);
     }
 }
Exemplo n.º 14
0
        protected override void LoadContent()
        {
            AudioEngine = new AudioEngine(@"Content\audio\GameAudio.xgs");
            WaveBank    = new WaveBank(AudioEngine, @"Content\audio\Wave Bank.xwb");
            SoundBank   = new SoundBank(AudioEngine, @"Content\audio\Sound Bank.xsb");

            var w = new WorldGrid();

            BasicManager.AddBasic(w);

            var p = new PlayerModel {
                Position = new Vector3(0, 0, 0)
            };

            BasicManager.AddBasic(p);

            var e = new SimpleEnemy {
                Position = new Vector3(-10, 2, 10)
            };

            BasicManager.AddBasic(e);

            Camera.Following = p;

            TrackCue = SoundBank.GetCue("music");
            TrackCue.Play();
            StateManager.StupidLoadContent();
        }
Exemplo n.º 15
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);
            }
        }
Exemplo n.º 16
0
 private void jump()
 {
     if ((double)this.minecartDY >= 1.0 || this.respawnCounter > 0)
     {
         return;
     }
     if (!this.isJumping)
     {
         this.movingOnSlope = 0;
         this.minecartPositionBeforeJump = this.mineCartYPosition;
         this.isJumping = true;
         if (this.minecartLoop != null)
         {
             this.minecartLoop.Stop(AudioStopOptions.Immediate);
         }
         if (Game1.soundBank != null)
         {
             Cue    cue  = Game1.soundBank.GetCue("pickUpItem");
             string name = "Pitch";
             double num  = 200.0;
             cue.SetVariable(name, (float)num);
             cue.Play();
         }
     }
     if (this.reachedJumpApex)
     {
         return;
     }
     this.minecartDY = Math.Max(-4.5f, this.minecartDY - 0.6f);
     if ((double)this.minecartDY > -4.5)
     {
         return;
     }
     this.reachedJumpApex = true;
 }
Exemplo n.º 17
0
        //* -----------------------------------------------------------------------*
        /// <summary>1フレーム分の更新処理を実行します。</summary>
        ///
        /// <param name="entity">この状態を適用されているオブジェクト。</param>
        /// <param name="privateMembers">
        /// オブジェクトと状態クラスのみがアクセス可能なフィールド。
        /// </param>
        /// <param name="gameTime">前フレームが開始してからの経過時間。</param>
        public override void update(
            CAudio entity, CAudio.CPrivateMembers privateMembers, GameTime gameTime)
        {
            List <Cue>    cueList      = privateMembers.cueList;
            List <string> reservedList = privateMembers.reservedList;

            for (int i = cueList.Count; --i >= 0;)
            {
                Cue cue = cueList[i];
                if (cue.IsStopped)
                {
                    // Cueクラスは使いまわすことができない
                    cue.Dispose();
                    cueList.RemoveAt(i);
                }
            }
            for (int i = reservedList.Count; --i >= 0;)
            {
                string name = reservedList[i];
                Cue    cue  = entity.find(name);
                if (cue == null || cue.GetVariable("AttackTime") >= entity.loopInterval)
                {
                    Cue newCue = entity.soundBank.GetCue(name);
                    newCue.Play();
                    cueList.Add(newCue);
                    reservedList.RemoveAt(i);
                }
            }
            privateMembers.engineUpdate();
        }
Exemplo n.º 18
0
 public override void farmerAdjacentAction(GameLocation location)
 {
     if (this.name == null || this.isTemporarilyInvisible)
     {
         return;
     }
     if (this.name.Contains("Block") && (this.pit != menu.sca + menu.gro || this.dur != menu.dur || this.sou != menu.labels[menu.labelIndex]))
     {
         this.pit = musicIndex.ContainsKey(menu.sca + menu.gro) ? menu.sca + menu.gro : null;
         this.dur = menu.dur;
         this.sou = menu.labels[menu.labelIndex];
     }
     if ((this.cue == null || Game1.currentGameTime.TotalGameTime.TotalMilliseconds - this.lastNoteBlockSoundTime >= 1000) && sou != null && pit != null && dur != null)
     {
         if (cueInternal != null && cueInternal.IsPlaying)
         {
             cueInternal.Stop(AudioStopOptions.AsAuthored);
         }
         cue = ModEntry.soundBank.GetCue(musicIndex[this.name] + musicIndex[sou] + musicIndex[dur] + musicIndex[pit]);
         cue.SetVariable("Volume", menu.value / 2.1f);
         if (menu.whetherToStopNextTime)
         {
             cueInternal = cue;
             cueInternal.Play();
         }
         else
         {
             cue.Play();
         }
         this.scale.Y                = 1.3f;
         this.shakeTimer             = 200;
         this.lastNoteBlockSoundTime = (int)Game1.currentGameTime.TotalGameTime.TotalMilliseconds;
         return;
     }
 }
Exemplo n.º 19
0
        /// <summary>
        /// Play a sound.
        /// </summary>
        /// <param name="name"></param>
        public static Cue PlayCue(string name)
        {
            Cue sound = m_soundBank.GetCue(name);

            sound.Play();
            return(sound);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Begins playback of this sound, or resumes playback (if it has been paused)
        /// </summary>
        #endregion
        public void Play()
        {
            if (mCue.IsDisposed || mCue.IsStopped)
            {
                // Get the cue again, since it has gone out of scope
                mCue = AudioManager.GetCue(mCueName, mSoundBankFile);

                // Setting this will reset the variables.
                Variables.Cue = mCue;
                if (OnCueRetrieved != null)
                {
                    OnCueRetrieved();
                }
            }

            if (mCue.IsPaused)
            {
                mCue.Resume();
            }
            else if (!mCue.IsPlaying && mCue.IsPrepared)
            {
                if (OnCueRetrieved != null)
                {
                    OnCueRetrieved();
                }
                mCue.Play();
            }
        }
Exemplo n.º 21
0
 public void StartCategoryTransition(bool toInGame)
 {
     transition = true;
     if (toInGame)
     {
         oldCategory     = menuCategory;
         currentCategory = graphXPackCategory;
         currentCategory.Stop(AudioStopOptions.Immediate);
         oldMusic        = currentMusic;
         currentPlaylist = graphXPackPlaylist;
         currentMusic    = soundBank.GetCue(GetRandomTrack(currentPlaylist));
         popUpText.Text  = currentPlaylist[currentMusic.Name];
         StartPopUp();
     }
     else
     {
         oldCategory     = graphXPackCategory;
         currentCategory = menuCategory;
         currentCategory.Stop(AudioStopOptions.Immediate);
         oldMusic        = currentMusic;
         currentPlaylist = playList;
         currentMusic    = soundBank.GetCue(GetRandomTrack(currentPlaylist));
         popUpText.Text  = currentPlaylist[currentMusic.Name];
         StartPopUp();
     }
     currentVolume = 0;
     currentCategory.SetVolume(currentVolume);
     currentMusic.Apply3D(new AudioListener(), new AudioEmitter());
     currentMusic.Play();
 }
Exemplo n.º 22
0
        public static void PlayAmbience(string sound)
        {
            if (!HasAudioDevice)
            {
                return;
            }
            Cue cue;

            if (!ActiveCues.TryGetValue(sound, out cue))
            {
                cue = SoundBank.GetCue(sound);
                ActiveCues[sound] = cue;
            }
            try
            {
                if (!cue.IsPlaying && !cue.IsStopped && !cue.IsStopping)
                {
                    cue.Play();
                }
                else if (cue.IsStopped)
                {
                    Cue newCue = SoundBank.GetCue(sound);
                    newCue.Play();
                    ActiveCues[sound] = newCue;
                }
            }
            catch (InvalidOperationException)
            {
                Cue newCue = SoundBank.GetCue(sound);
                newCue.Play();
                ActiveCues[sound] = newCue;
            }
        }
Exemplo n.º 23
0
 // Token: 0x06000D40 RID: 3392 RVA: 0x0010C3A8 File Offset: 0x0010A5A8
 private void jump()
 {
     if (this.minecartDY < 1f && this.respawnCounter <= 0)
     {
         if (!this.isJumping)
         {
             this.movingOnSlope = 0;
             this.minecartPositionBeforeJump = this.mineCartYPosition;
             this.isJumping = true;
             if (this.minecartLoop != null)
             {
                 this.minecartLoop.Stop(AudioStopOptions.Immediate);
             }
             if (Game1.soundBank != null)
             {
                 Cue expr_68 = Game1.soundBank.GetCue("pickUpItem");
                 expr_68.SetVariable("Pitch", 200f);
                 expr_68.Play();
             }
         }
         if (!this.reachedJumpApex)
         {
             this.minecartDY = Math.Max(-4.5f, this.minecartDY - 0.6f);
             if (this.minecartDY <= -4.5f)
             {
                 this.reachedJumpApex = true;
             }
         }
     }
 }
Exemplo n.º 24
0
        public override void keyPressed(Keys key)
        {
            if (key == Keys.Enter)
            {
                optionSelected = game.soundBank.GetCue("optionselected");
                optionSelected.Play();

                if (selected == Options.MENU)
                {
                    game.changeState(Type.MENU);
                }
                else
                {
                    game.changeState(Type.GAME);
                }
            }

            if (key == Keys.Up)
            {
                selected   = selected == Options.MENU ? Options.RETRY : Options.MENU;
                optionOver = game.soundBank.GetCue("optionover");
                optionOver.Play();
            }
            else if (key == Keys.Down)
            {
                selected   = selected == Options.MENU ? Options.RETRY : Options.MENU;
                optionOver = game.soundBank.GetCue("optionover");
                optionOver.Play();
            }
        }
Exemplo n.º 25
0
        public static Cue Play(string Name)
        {
            Cue returnValue = soundbank.GetCue(Name);

            returnValue.Play();
            return(returnValue);
        }
Exemplo n.º 26
0
        protected void UpdateInput()
        {
            KeyboardState key = Keyboard.GetState();

            if (key.IsKeyDown(Keys.Up))
            {
                if (engineSound == null)
                {
                    engineSound = soundBank.GetCue("engine_2");
                    engineSound.Play();
                }

                else if (engineSound.IsPaused)
                {
                    engineSound.Resume();
                }
            }
            viper.Update(key);

            // In case you get lost, press A to warp back to the center.
            if (key.IsKeyDown(Keys.Space))
            {
                viper.position = Vector3.Zero;
                viper.velocity = Vector3.Zero;
                viper.Rotation = 0.0f;
            }
        }
Exemplo n.º 27
0
        public static void RaceStart(int count)
        {
            BeatShift.engine.SetGlobalVariable("Countdown", count);
            Cue temp = soundBank.GetCue("countdown");

            temp.Play();
        }
Exemplo n.º 28
0
 public void currentState(GameState state)
 {
     if (this.state != state)
     {
         bool isLoop        = (state == GameState.anim_idle || state == GameState.anim_walk || state == GameState.anim_run || state == GameState.anim_attackidle);
         bool lastIsLoop    = (this.state == GameState.anim_idle || this.state == GameState.anim_walk || this.state == GameState.anim_run || this.state == GameState.anim_attackidle);
         bool isAttackState = (state == GameState.anim_attack1 || state == GameState.anim_attack2 || state == GameState.anim_attack3);
         if (!lastIsLoop)
         {
             if (model.isAnimated())
             {
                 model.playClip((short)state, isLoop);
                 this.state = state;
             }
         }
         else
         {
             model.playClip((short)state, isLoop);
             this.state = state;
         }
         if (isAttackState)
         {
             model.playClip((short)state, isLoop);
             this.state = state;
             if (model != null)
             {
                 Random rand = new Random();
                 audioEmitter.Position = model._Position;
                 Cue cue = audioSystem.getSoundBank().GetCue("att-0." + rand.Next(1, 2));
                 cue.Apply3D(audioSystem.getAudioListener(), audioEmitter);
                 cue.Play();
             }
         }
     }
 }
        protected override void Update(GameTime gameTime)
        {
            GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);

            if (gamePadState.Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            KeyboardState keyState = Keyboard.GetState();

            if (keyState.IsKeyDown(Keys.Space) || (gamePadState.Buttons.B == ButtonState.Pressed))
            {
                if ((cue1 == null) || (cue1.IsStopped))
                {
                    cue1 = soundBank.GetCue("audio1");
                    cue1.Play();
                }
            }
            if (keyState.IsKeyDown(Keys.Enter) || (gamePadState.Buttons.A == ButtonState.Pressed))
            {
                if (cue1 != null)
                {
                    cue1.Stop(AudioStopOptions.Immediate);
                }
            }

            audioEngine.Update();

            base.Update(gameTime);
        }
Exemplo n.º 30
0
 public void PlayMusic(string i_SoundEffectName)
 {
     if (!m_IsMusicMutted)
     {
         Cue soundCue = r_SoundBank.GetCue(i_SoundEffectName);
         soundCue.Play();
     }
 }
Exemplo n.º 31
0
        public void PrevSong()
        {
            if (SongList.Count == 0)
                return;

            if (currentSongCue != null && currentSongCue.IsPlaying)
                currentSongCue.Stop(AudioStopOptions.AsAuthored);

            currentSongId = (--currentSongId + SongList.Count) % SongList.Count;

            #if !USE_XACT
            gameHasControl = MediaPlayer.GameHasControl;
            if (gameHasControl)
            {
                currentMediaPlayerSong = songs[SongList[currentSongId]];
                try
                {
                    MediaPlayer.Play(currentMediaPlayerSong);
                    MediaPlayer.IsRepeating = true;
                }
                catch { }
            }
            #else
            currentSongCue = currentSoundBank.GetCue(SongList[currentSongId]);
            currentSongCue.Play();
            #endif
        }
Exemplo n.º 32
0
        public Cue PlaySong(string name, float delayTime)
        {
            if (currentSongCue != null && currentSongCue.IsPlaying)
                currentSongCue.Stop(AudioStopOptions.AsAuthored);

            #if !USE_XACT
            currentMediaPlayerSong = songs[name];
            if (delayTime <= 0.0f)
            {
                gameHasControl = MediaPlayer.GameHasControl;
                if (gameHasControl)
                {
                    try
                    {
                        MediaPlayer.Play(currentMediaPlayerSong);
                        MediaPlayer.IsRepeating = true;
                    }
                    catch { }
                }
            }
            else
            {
                currentSongDelayTime = delayTime;
                currentSongDelayTimeTotal = delayTime;
            }
            return null;
            #else
            currentSongCue = currentSoundBank.GetCue(name);
            if (delayTime <= 0.0f)
            {
                currentSongDelayTime = -1.0f;

                currentSongCue.Play();
            }
            else
            {
                currentSongDelayTime = delayTime;
            }

            return currentSongCue;
            #endif
        }
Exemplo n.º 33
0
        /// <summary>
        /// Starts a new combat stage.  Called right after the stage changes.
        /// </summary>
        /// <remarks>The stage never changes into NotStarted.</remarks>
        protected override void StartStage()
        {
            switch (stage)
            {
                case CombatActionStage.Preparing: // called from Start()
                    {
                        // play the animations
                        combatant.CombatSprite.PlayAnimation("SpellCast");
                        spellSpritePosition = Combatant.Position;
                        spell.SpellSprite.PlayAnimation("Creation");
                        // remove the magic points
                        Combatant.PayCostForSpell(spell);
                    }
                    break;

                case CombatActionStage.Advancing:
                    {
                        // play the animations
                        spell.SpellSprite.PlayAnimation("Traveling");
                        // calculate the projectile destination
                        projectileDirection = Target.Position -
                            Combatant.OriginalPosition;
                        totalProjectileDistance = projectileDirection.Length();
                        projectileDirection.Normalize();
                        projectileDistanceCovered = 0f;
                        // determine if the projectile is flipped
                        if (Target.Position.X > Combatant.Position.X)
                        {
                            projectileSpriteEffect = SpriteEffects.FlipHorizontally;
                        }
                        else
                        {
                            projectileSpriteEffect = SpriteEffects.None;
                        }
                        // get the projectile's cue and play it
                        projectileCue = AudioManager.GetCue(spell.TravelingCueName);
                        if (projectileCue != null)
                        {
                            projectileCue.Play();
                        }
                    }
                    break;

                case CombatActionStage.Executing:
                    {
                        // play the animation
                        spell.SpellSprite.PlayAnimation("Impact");
                        // stop the projectile sound effect
                        if (projectileCue != null)
                        {
                            projectileCue.Stop(AudioStopOptions.Immediate);
                        }
                        // apply the spell effect to the primary target
                        bool damagedAnyone = ApplySpell(Target);
                        // apply the spell to the secondary targets
                        foreach (Combatant targetCombatant in
                            CombatEngine.SecondaryTargetedCombatants)
                        {
                            // skip dead or dying targets
                            if (targetCombatant.IsDeadOrDying)
                            {
                                continue;
                            }
                            // apply the spell
                            damagedAnyone |= ApplySpell(targetCombatant);
                        }
                        // play the impact sound effect
                        if (damagedAnyone)
                        {
                            AudioManager.PlayCue(spell.ImpactCueName);
                            if (spell.Overlay != null)
                            {
                                spell.Overlay.PlayAnimation(0);
                                spell.Overlay.ResetAnimation();
                            }
                        }
                    }
                    break;

                case CombatActionStage.Returning:
                    // play the animation
                    combatant.CombatSprite.PlayAnimation("Idle");
                    break;

                case CombatActionStage.Finishing:
                    // play the animation
                    combatant.CombatSprite.PlayAnimation("Idle");
                    break;

                case CombatActionStage.Complete:
                    // play the animation
                    combatant.CombatSprite.PlayAnimation("Idle");
                    // make sure that the overlay has stopped
                    spell.Overlay.StopAnimation();
                    break;
            }
        }