Пример #1
0
 public override void playCrashSound(int x, int y)
 {
     if (crashSound == null)
     {
         crashSound = DSound.LoadSoundAlwaysLoud(DSound.SoundPath + "\\a_fwall.wav");
     }
     DSound.PlaySound3d(crashSound, true, false, x, 0, y);
 }
Пример #2
0
 /// <summary>
 /// Creates a new missile.
 /// </summary>
 /// <param name="thrower">The Person throwing the missile.</param>
 /// <param name="target">The target Person.</param>
 /// <param name="speed">The number of milliseconds to elapse between each move of the missile.</param>
 /// <param name="maxDamage">The maximum damage the missile can cause.</param>
 public PersonMissile(Person thrower, Person target, int speed, int maxDamage)
 {
     x              = thrower.x;
     y              = thrower.y;
     this.speed     = speed;
     this.maxDamage = maxDamage;
     this.target    = target;
     startTime      = DateTime.Now;
     moveSound      = DSound.LoadSoundAlwaysLoud(DSound.SoundPath + "\\a_mmove.wav");
     explodeSound   = DSound.LoadSoundAlwaysLoud(DSound.SoundPath + "\\a_mexpl.wav");
     DSound.PlaySound3d(moveSound, true, true, x, 0, y);
 }
Пример #3
0
        protected ExtendedAudioBuffer loadSound(string filename)
        {
            ExtendedAudioBuffer s = null;

            if (isAI)
            {
                s = DSound.LoadSoundAlwaysLoud(DSound.SoundPath + "\\a_" + filename);
            }
            else
            {
                s = DSound.LoadSoundAlwaysLoud(DSound.SoundPath + "\\" + filename);
            }
            return(s);
        }
Пример #4
0
 private void playMessage(String o, bool wait)
 {
     if (message != null)
     {
         message.stop();
     }
     message = DSound.LoadSoundAlwaysLoud(o);
     DSound.PlaySound(message, true, false);
     if (wait)
     {
         Interaction.stopAndMute(true);
         while (DSound.isPlaying(message))
         {
             Thread.Sleep(100);
         }
         Interaction.resumeAndUnmute();
     }             //if wait
 }
Пример #5
0
        public ExtendedAudioBuffer loadSound(string filename, bool notifications, bool alwaysLoud)
        {
            ExtendedAudioBuffer s = null;

            if (isAI && !autoPlayTarget)
            {
                if (!forceStareo)
                {
                    s = (!alwaysLoud)? DSound.LoadSound(filename, notifications): DSound.LoadSoundAlwaysLoud(filename, notifications);
                }
                else
                {
                    s = (!alwaysLoud)? DSound.LoadSound(filename, notifications): DSound.LoadSoundAlwaysLoud(filename, notifications);
                }
            }
            else             //Either this is not AI or this is autoPlayTarget
            {
                s = (!alwaysLoud) ? DSound.LoadSound(filename, notifications) : DSound.LoadSoundAlwaysLoud(filename, notifications);
            }
            return(s);
        }
Пример #6
0
        public static void NLS(string sFilename, bool NWait, long TheRate)
        {
            try
            {
                stopLastFile();
                filesPlaying = true;
                files        = new StringBuilder();
                String[] SFiles = sFilename.Split('&');
                for (int i = 0; i < SFiles.Length; i++)
                {
                    sFilename = SFiles[i];
                    //if # is in front of array element author wants that element to be num voiced,
                    //and it is not a .wav file.
                    if (sFilename.Contains("#"))
                    {
                        processNumber(
                            sFilename.Substring(
                                sFilename.IndexOf("#") + 1
                                ));
                    }
                    else
                    {
                        //if reg .wav file
                        sFilename = processFileName(sFilename);
                        files.Append(sFilename);
                        if (i != SFiles.Length - 1)
                        {
                            files.Append("&");
                        }
                    }             //if not number
                }                 //loop

                //Now we have all the files to play.
                String[] finalFiles = files.ToString().Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
                soundFiles = new ExtendedAudioBuffer[finalFiles.Length];
                bool firstLoop = true;
                for (globalCounter = 0; globalCounter < soundFiles.Length; globalCounter++)
                {
                    if (firstLoop)
                    {
                        soundFiles[globalCounter] = DSound.LoadSoundAlwaysLoud(finalFiles[globalCounter]);
                    }
                    DSound.PlaySound(soundFiles[globalCounter], true, false);
                    if (globalCounter < finalFiles.Length - 1)
                    {
                        soundFiles[globalCounter + 1] = DSound.LoadSoundAlwaysLoud(finalFiles[globalCounter + 1]);
                    }
                    firstLoop = false;
                    //Next, if only playing one file, return since we're probably in a menu.
                    if (soundFiles.Length != 1 || NWait)
                    {
                        NumWait();
                    }

                    if (nStop)
                    {
                        filesPlaying = false;
                        return;
                    }
                }

                //next, global counter may be == length
                //of array since we completed the loop
                //so back it up to stop properly.
                if (globalCounter == soundFiles.Length)
                {
                    globalCounter--;
                }
                filesPlaying = false;
            }
            catch (Exception e)
            {
                Common.handleError(e);
            }
        }