Exemplo n.º 1
0
    public void Swap(string _name)
    {
        if (m_audioclipmap.ContainsKey(_name))
        {
            AudioWrapper ap = frontpeer;
            frontpeer.SetFadeOut();
            frontpeer = backpeer;
            frontpeer.SetAudioClip(m_audioclipmap[_name]);
            frontpeer.SetFadeIn();
            frontpeer.StartPlaying();
            backpeer = ap;

            _ba.ReadBpm(frontpeer.GetComponent <AudioSource>().clip.name);
        }
        else
        {
            m_audioclipmap.Add(_name, GetComponent <AudioLoader>().LoadSong(_name));
        }

        //UniBpmAnalyzer.AnalyzeBpm(frontpeer.GetComponent<AudioSource>().clip);
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (PlayerController._crescendo)
        {
            if (m_playqueue.Count > 0 && !QTE)
            {
                next = _stateGenerator.GenerateState(StateGenerator.GenerateType.QUICKTIMEEVENTSTATE, m_playqueue.Peek().GetClipName(), m_audioclipmap[m_playqueue.Peek().GetClipName()]);
                QTE  = true;
            }
        }
        if (swap && m_playqueue.Count > 0)
        {
            curr.StopRun();
            curr = m_playqueue.Dequeue();
            if (QTE)
            {
                curr = next;
                QTE  = false;
            }
            curr.Run();

            AudioWrapper ap = frontpeer;
            frontpeer.SetFadeOut();
            frontpeer = backpeer;
            frontpeer.SetAudioClip(m_audioclipmap[curr.GetClipName()]);
            frontpeer.SetFadeIn();
            frontpeer.StartPlaying();
            backpeer = ap;
            swap     = !swap;
        }
        else if (m_playqueue.Count <= 0)
        {
            playerScore.SaveScore();
            SceneManager.LoadScene("SongEndScene");
        }
    }