/// <summary> /// Draws the fields related to the inspector drawer. /// </summary> /// <param name="target">The object that is being drawn.</param> /// <param name="parent">The Unity Object that the object belongs to.</param> protected override void DrawInspectorDrawerFields(object target, Object parent) { ObjectInspector.DrawFields(target, true); m_PlayAudioClip = (target as PlayAudioClip); AudioClipSetInspector.DrawAudioClipSet(m_PlayAudioClip.AudioClipSet, null, ref m_AudioClipsList, OnAudioClipDraw, OnAudioClipListAdd, OnAudioClipListRemove); }
void PlayClipCallback(GameEvent e) { PlayAudioClip ev = (PlayAudioClip)e; masterSrc.volume = 0; masterSrc.pitch = ev.AudioObject.DefaultPitch; masterSrc.clip = ev.AudioObject.Clip; masterSrc.loop = ev.Loop; eventCtrl.BroadcastEvent(typeof(FadeAudioEvent), new FadeAudioEvent(masterSrc, ev.AudioObject.DefaultVolume, ev.FadeRate, ev.FadeDelay)); masterSrc.Play(); if (sourceToClipDict.ContainsKey(masterSrc)) { clipToSourceDict.Remove(sourceToClipDict[masterSrc]); sourceToClipDict.Remove(masterSrc); } int newId = 0; if (clipIdPool.Count <= 0) { newId = currentId++; } else { newId = clipIdPool.Dequeue(); } clipToSourceDict.Add(newId, masterSrc); sourceToClipDict.Add(masterSrc, newId); ev.InfoCallback?.Invoke(newId); }
// Use this for initialization void Start() { scoreUpdate = GameObject.Find("EventSystem").GetComponent <ScoreUpdate>(); starScore = GameObject.Find("EventSystem").GetComponent <DisplayStars>(); playerObj = GameObject.Find("PlayerSphere"); currentLevelStats = GameObject.Find("UI").GetComponent <Levels>(); playerController = playerObj.GetComponent <PlayerController>(); audioClipPlayer = GameObject.Find("UI").GetComponent <PlayAudioClip>(); }
private void Awake() { audio = GameObject.FindGameObjectWithTag("CollectableAudio").GetComponent <PlayAudioClip>(); }
// Use this for initialization void Start() { UI = GameObject.Find("UI"); pause = UI.GetComponent <Pause>(); audioClipPlayer = UI.GetComponent <PlayAudioClip>(); }