void SetReferences() { coroutineHolder = gameObject.GetOrAddComponent <CoroutineHolder>(); listener = FindObjectOfType <AudioListener>(); listenerTransform = listener.transform; BuildModulesDict(); }
public override void Execute() { _soundOnUse.Play(); _disablePlayerController.Raise(); CoroutineHolder handler = Instantiate(_holder); handler.StartCoroutine(Teleport(handler.gameObject)); _enablePlayerController.Raise(); }
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; }
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(); } }
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."); } } }
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); }