示例#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();
    }
示例#2
0
    int[] getActiveLanes(Onset onset, int totalLanes)
    {
        int[] activeLanes = new int[AssetManager.MAX_LANES];

        chromaFeatures.Clear();
        rhythmData.GetIntersectingFeatures(chromaFeatures, onset.timestamp, onset.timestamp);

        //TODO this patternActive max maybe should be done to spawner, so that generation is always same regardless of setting value
        for (int n = 0; n < Math.Min(Settings.instance.patternMaxActiveLanesAtOnce, chromaFeatures.Count); n++)
        {
            int lane = (int)((int)chromaFeatures[n].note * totalLanes / 12f);
            activeLanes[lane] = 1;

            //chromaFeatures.Clear();
            //rhythmData.GetIntersectingFeatures(chromaFeatures, beat.timestamp, beat.timestamp);

            //for (int n = 0; n < Math.Min(Settings.instance.patternMaxActiveLanes, chromaFeatures.Count); n++)
            //{
            //    int lane = (int)((int)chromaFeatures[n].note * totalLanes / 12f);
            //    activeLanes[lane] = 1;
            //}
        }
        return(activeLanes);
    }