コード例 #1
0
ファイル: Game.cs プロジェクト: shadowmint/pongstar
        public static void SetupAudio(nAudio a)
        {
            if (!_soundReady) {
            _bop = (AudioClip)Resources.Load("audio/bop");
            _boop = (AudioClip)Resources.Load("audio/boop");
            _playerAudio = a.Source();
            _playerAudio.loop = false;
            _playerAudio.clip = _boop;
            _playerAudio.volume = 0.5f;
            _aiAudio = a.Source();
            _aiAudio.loop = false;
            _aiAudio.clip = _bop;
            _aiAudio.volume = 0.5f;
            _wallAudio = a.Source();
            _wallAudio.loop = false;
            _wallAudio.clip = _bop;
            _wallAudio.pitch = 1.5f;
            _wallAudio.volume = 0.5f;

            /* Setup channel for stars */
            a.Channel(COLLECT_STAR_CHANNEL, 6);
            a.Register(COLLECT_STAR_CHANNEL, COLLECT_STAR_BING1, "audio/star1");
            a.Register(COLLECT_STAR_CHANNEL, COLLECT_STAR_BING2, "audio/star2");
            a.Register(COLLECT_STAR_CHANNEL, COLLECT_STAR_BING3, "audio/star3");
            a.Register(COLLECT_STAR_CHANNEL, COLLECT_STAR_BING4, "audio/star4");

            /* Setup channel for win lose sounds */
            a.Channel(WIN_LOSE_CHANNEL, 1);
            a.Register(WIN_LOSE_CHANNEL, WIN_SOUND, "audio/win");
            a.Register(WIN_LOSE_CHANNEL, LOSE_SOUND, "audio/lose");

            /* Music */
            a.Channel(MUSIC_CHANNEL, 1);
            a.Register(MUSIC_CHANNEL, MUSIC_0, "audio/theme");
            a.Repeat(MUSIC_CHANNEL, MUSIC_0, 0.1f);

            _soundReady = true;
              }
        }
コード例 #2
0
ファイル: nAudio.cs プロジェクト: shadowmint/pongstar
 /** Reload using a new audio parent */
 public void Reload(nAudio parent)
 {
     for (var i = 0; i < _workers.Length; ++i) {
     _workers[i] = parent.Source();
       }
 }