Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
 // 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>();
 }
Esempio n. 4
0
 private void Awake()
 {
     audio = GameObject.FindGameObjectWithTag("CollectableAudio").GetComponent <PlayAudioClip>();
 }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     UI              = GameObject.Find("UI");
     pause           = UI.GetComponent <Pause>();
     audioClipPlayer = UI.GetComponent <PlayAudioClip>();
 }