示例#1
0
        public static void Init()
        {
            Sound.honkBiteSoundPlayer = new Sound.Mp3Player(Sound.honkSources[0], "honkPlayer");
            Sound.patSoundPool        = new SoundPlayer[Sound.patSources.Length];
            for (int index = 0; index < Sound.patSources.Length; ++index)
            {
                //Sound.patSoundPool[index] = new SoundPlayer(Sound.patSources[index]);
                //Sound.patSoundPool[index].Load();
            }
            Sound.environmentSoundsPlayer = new Sound.Mp3Player(Program.GetPathToFileInAssembly("Assets/Sound/NotEmbedded/MudSquith.mp3"), "assortedEnvironment");
            string toFileInAssembly = Program.GetPathToFileInAssembly("Assets/Sound/Music/Music.mp3");

            if (!File.Exists(toFileInAssembly))
            {
                return;
            }
            Sound.musicPlayer      = new Sound.Mp3Player(toFileInAssembly, "musicPlayer");
            Sound.musicPlayer.loop = true;
            Sound.musicPlayer.SetVolume(0.5f);
            Sound.musicPlayer.Play();
        }
        public static void Init()
        {
            Sound.honkBiteSoundPlayer = new Sound.Mp3Player(Sound.honkSources[0], "honkPlayer");
            Sound.patSoundPool        = new SoundPlayer[(int)Sound.patSources.Length];
            for (int i = 0; i < (int)Sound.patSources.Length; i++)
            {
                Sound.patSoundPool[i] = new SoundPlayer(Sound.patSources[i]);
                Sound.patSoundPool[i].Load();
            }
            Sound.environmentSoundsPlayer = new Sound.Mp3Player(Program.GetPathToFileInAssembly("Assets/Sound/NotEmbedded/MudSquith.mp3"), "assortedEnvironment");
            string pathToFileInAssembly = Program.GetPathToFileInAssembly("Assets/Sound/Music/Music.mp3");

            if (File.Exists(pathToFileInAssembly))
            {
                Sound.musicPlayer = new Sound.Mp3Player(pathToFileInAssembly, "musicPlayer")
                {
                    loop = true
                };
                Sound.musicPlayer.SetVolume(0.5f);
                Sound.musicPlayer.Play();
            }
        }