Esempio n. 1
0
 void SetReferences()
 {
     coroutineHolder   = gameObject.GetOrAddComponent <CoroutineHolder>();
     listener          = FindObjectOfType <AudioListener>();
     listenerTransform = listener.transform;
     BuildModulesDict();
 }
Esempio n. 2
0
        public override void Execute()
        {
            _soundOnUse.Play();
            _disablePlayerController.Raise();
            CoroutineHolder handler = Instantiate(_holder);

            handler.StartCoroutine(Teleport(handler.gameObject));
            _enablePlayerController.Raise();
        }
Esempio n. 3
0
        public SingleAudioItem(string name, int id, AudioSource audioSource, AudioInfo audioInfo, GameObject gameObject, CoroutineHolder coroutineHolder, GainManager gainManager, AudioItemManager itemManager, Magicolo.AudioTools.Player player)
            : base(name, id, itemManager, player)
        {
            this.audioSource     = audioSource;
            this.audioInfo       = audioInfo;
            this.gameObject      = gameObject;
            this.coroutineHolder = coroutineHolder;
            this.gainManager     = gainManager;

            Pitch = audioSource.pitch;
        }
Esempio n. 4
0
 void Awake()
 {
     if (Application.isPlaying)
     {
         coroutineHolder = gameObject.GetOrAddComponent <CoroutineHolder>();
         if (instruments != null)
         {
             foreach (Instrument instrument in instruments)
             {
                 instrument.BuildOriginalClips();
                 instrument.GenerateMissingClips();
             }
         }
         BuildInstrumentDict();
     }
 }
        public override void Initialize()
        {
            instance        = this;
            Enabled         = true;
            coroutineHolder = new GameObject("EasyMode Coroutine Holder").AddComponent <CoroutineHolder>();
            UnityEngine.Object.DontDestroyOnLoad(coroutineHolder);

            ModHooks.GetPlayerIntHook      += GetInt;
            ModHooks.SetPlayerIntHook      += SetInt;
            On.PlayerData.UpdateBlueHealth += BlueHealthHook;
            On.HeroController.Start        += OnStart;
            if (HeroController.instance != null)
            {
                ToggleShadeSpawn();
                ToggleFastFocus();
            }
        }
Esempio n. 6
0
 protected virtual void Awake()
 {
     if (Application.isPlaying)
     {
         audioPlayer     = gameObject.GetOrAddComponent <AudioPlayer>();
         audioSettings   = audioPlayer.audioSettings;
         infoManager     = audioPlayer.hierarchyManager;
         metronome       = gameObject.GetOrAddComponent <Metronome>();
         coroutineHolder = gameObject.GetOrAddComponent <CoroutineHolder>();
         listener        = FindObjectOfType <AudioListener>();
         if (listener == null)
         {
             GameObject newListener = new GameObject("Listener");
             listener = newListener.AddComponent <AudioListener>();
             listener.transform.Reset();
             Debug.LogWarning("No listener was found in the scene. One was automatically created.");
         }
     }
 }
Esempio n. 7
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);
        }
Esempio n. 8
0
 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);
 }