Exemple #1
0
        public AudioItem GetAudioItem(string moduleName, string soundName, GameObject source, params AudioOption[] audioOptions)
        {
            AudioInfo   audioInfo   = infoManager.GetAudioInfo(soundName);
            AudioSource audioSource = GetAudioSource(audioInfo, source, audioOptions);

            GameObject      gameObject      = audioSource.gameObject;
            CoroutineHolder coroutineHolder = gameObject.GetOrAddComponent <CoroutineHolder>();

            PDGainManager gainManager = gameObject.GetOrAddComponent <PDGainManager>();

            idCounter += 1;
            PDSingleAudioItem audioItem = new PDSingleAudioItem(moduleName + "_" + soundName, idCounter, audioSource, audioInfo, gameObject, coroutineHolder, gainManager, this, pdPlayer);

            gainManager.Initialize(audioItem, pdPlayer);
            audioItem.Update();
            player.metronome.Subscribe(audioItem);
            inactiveAudioItems.Add(audioItem);

            return(audioItem);
        }
 public PDSingleAudioItem(string name, int id, AudioSource audioSource, AudioInfo audioInfo, GameObject gameObject, CoroutineHolder coroutineHolder, PDGainManager gainManager, PDAudioItemManager itemManager, PDPlayer pdPlayer)
     : base(name, id, audioSource, audioInfo, gameObject, coroutineHolder, gainManager, itemManager, pdPlayer)
 {
     this.pdPlayer = pdPlayer;
     pdPlayer.communicator.SendValue(Name + "_Volume", Volume);
 }