Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        foreach (AudioClip ac in AudioSplitter.SplitClip(_sample))
        {
            m_audioclipmap.Add(ac.name, ac);
            //BaseState1 bs = _stateGenerator.MultiHighState(ac.name, ac, 4.0f);
            //foreach (float f in musicprojectile.bassList)
            //{
            //    if (f > offset + ac.length)
            //        break;
            //    else if (f < offset)
            //        continue;
            //    if (f > offset && f < offset + ac.length)
            //        bs.AddBeat(BaseState1.Type.BASS_TYPE, f - offset);
            //}

            //foreach (float f in musicprojectile.kickList)
            //{
            //    if (f > offset + ac.length)
            //        break;
            //    else if (f < offset)
            //        continue;
            //    if (f > offset && f < offset + ac.length)
            //        bs.AddBeat(BaseState1.Type.KICK_TYPE, f - offset);

            //}

            //foreach (float f in musicprojectile.highList)
            //{
            //    if (f > offset + ac.length)
            //        break;
            //    else if (f < offset)
            //        continue;
            //    if (f > offset && f < offset + ac.length)
            //        bs.AddBeat(BaseState1.Type.GENERAL_TYPE, f - offset);
            //}
            //bs.PushAttacksIntoList();
            //m_playqueue.Enqueue(bs);
            //offset += ac.length;
            m_playqueue.Enqueue(_stateGenerator.GenerateState(StateGenerator.GenerateType.NUMSTATE, ac.name, ac, 4.0f));
            //m_playqueue.Enqueue(_stateGenerator.CreateVerticalLaserAttack(ac.name,ac,4.0f));
        }
        curr = m_playqueue.Dequeue();
        curr.Run();
        Debug.Log(m_audioclipmap[curr.GetClipName()]);
        frontpeer.SetAudioClip(m_audioclipmap[curr.GetClipName()]);
        frontpeer.StartPlaying();
    }
Esempio n. 2
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);
    }
Esempio n. 3
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");
        }
    }