Example #1
0
    void Awake()
    {
        txt            = GameObject.Find("HRText").GetComponent <TMPro.TMP_Text>();
        heartText      = GameObject.Find("hrui").GetComponent <TMPro.TMP_Text>();
        beats          = new List <Beat>();
        onsetFeatures  = new List <Onset>();
        chromaFeatures = new List <Chroma>();
        musicPlayer    = GetComponent <MusicPlayer>();
        audioSource    = GetComponent <AudioSource>();
        rhythmPlayer   = GetComponent <RhythmPlayer>();

        rhythmData.GetIntersectingFeatures(onsetFeatures, 0, 200);
        rhythmData.GetIntersectingFeatures(beats, 0, 200);
        rhythmData.GetFeatures(chromaFeatures, 0, 200);

//        UnityEngine.Debug.Log(onsetFeatures);


        foreach (var onset in onsetFeatures) //여기서생성
        {
            SpawnRandomFootNote(onset.timestamp).importance = onset.strength;
            SpawnRandomNote(onset.timestamp).importance     = onset.strength;
        }
        //foreach(var chroma in chromaFeatures)
        {
            //    SpawnRandomNote(chroma.timestamp);
        }


        rhythmPlayer.Play();
    }
Example #2
0
    void Start()
    {
        if (m_instance == null)
        {
            m_instance = this;

            m_rhythmosDatabase = new RhythmosDatabase();

            m_rhythmosDatabase.LoadRhythmosDatabase(m_rhythmosFile);

            DontDestroyOnLoad(this);
        }
        else
        {
            if (this != m_instance)
            {
                Destroy(this.gameObject);
            }
        }
    }
Example #3
0
 private void InitializeComponents()
 {
     _audioSource  = GetComponent <AudioSource>();
     _rhythmPlayer = GetComponent <RhythmPlayer>();
 }