コード例 #1
0
 // copy constructor
 public NoteSpec(NoteSpec n)
 {
     this.timing      = n.timing;
     this.pitch       = n.pitch;
     this.emotionType = n.emotionType;
     this.elevation   = n.elevation;
     this.instrument  = n.instrument;
     this.lyric       = n.lyric;
 }
コード例 #2
0
    private void LoadSong()
    {
        // for testing new songs
        // activity.song = new Heartbeat(EmotionType.anxiety).song;
        // activity.tempoIncrement = .2f;
        // activity.song = Hero.song;
        // activity.tempoIncrement = .16f;
        // activity.song = WakeUpGetOutThere.song;
        // activity.tempoIncrement = .2f;
        // activity.song = Luma.song;
        // activity.tempoIncrement = .2f;
        // activity.song = MumenRider.song;
        // activity.tempoIncrement = .2f;

        // time between smallest increments of a rhythm pattern
        tempoIncrement = activity.tempoIncrement;
        // duration before arrival time that is considered a miss for the incoming note
        // (if you hit earlier than this, then it won't be punished)
        earlyHitPeriod = tempoIncrement;
        // duration after arrival time that is considered a miss for the next note
        lateHitPeriod = hitWindowLate + tempoIncrement / 2;
        // clear out old notes, (should be none, but just in case)
        ClearAllNotes();
        // reset time
        time = 0;

        // load in notes for this activity, sort by timing
        List <NoteSpec> pattern = activity.song.notes.OrderBy(n => n.timing).ToList();

        if (runManager.runState.timeSteps == 0)
        {
            // dummy song for first
            pattern = new List <NoteSpec>
            {
                new NoteSpec(0, "C4", (int)BeamCenterElevation()),
                new NoteSpec(4, "C4", (int)BeamCenterElevation()),
            };
        }
        Debug.Assert(activity.song.Length() > 0);
        NoteSpec easiestNote = activity.song.notes.OrderBy(n => n.elevation).OrderBy(n => n.timing).ToList()[0];

        for (int i = 0; i < pattern.Count; i++)
        {
            NoteSpec  n         = pattern[i];
            float     spawnTime = n.timing * tempoIncrement;
            AudioClip clip      = Resources.Load <AudioClip>(n.GetAudioFilePath());
            if (clip == null)
            {
                Debug.Log("Could not find clip: " + n.GetAudioFilePath());
            }
            EmotionType type = EmotionType.None;
            if (n != easiestNote && n.emotionType == EmotionType.None)
            {
                type = ChooseEmotionType();
            }
            // also first activity is all energy notes if need to show tutorial
            if (runManager.runState.activityHistory.Count() < 2 && gameManager.showEmotionNoteTutorial)
            {
                type = EmotionType.None;
            }
            notesToSpawn.Add(new NoteSpawnSpec(spawnTime, type, clip, n.elevation, n.GetVolume(), n.lyric));
        }
    }