private void SpawnMusicNote(Aggregate note) { /*if (note.noteIndex % 2 == 0) { * GetComponent<AudioSource>().Play(); * }*/ spawner.SpawnNote(note.data, selectedMelodies[note.melodyIndex]); }
private void SpawnNotesForChord(Chord chord) { List <ButtonEnum> buttons = new List <ButtonEnum>(); foreach (Melanchall.DryWetMidi.Smf.Interaction.Note note in chord.Notes) { switch (note.NoteName) { case Melanchall.DryWetMidi.Common.NoteName.C: buttons.Add(ButtonEnum.A); break; case Melanchall.DryWetMidi.Common.NoteName.CSharp: buttons.Add(ButtonEnum.B); break; case Melanchall.DryWetMidi.Common.NoteName.D: buttons.Add(ButtonEnum.X); break; case Melanchall.DryWetMidi.Common.NoteName.DSharp: buttons.Add(ButtonEnum.Y); break; } } spawner.SpawnNote(buttons); }
public IEnumerator StartSong(string chartFile) { ActiveSong = new SongLoader(chartFile).LoadSong(); //messy temporary song initialisation for testing. yield return(null); ActiveChart = ActiveSong.Charts[0]; yield return(AudioHelper.LoadAudio(source, ActiveSong)); if (_stateHolder.StartFrom > 0f) { source.time = _stateHolder.StartFrom; } source.Play(); _invSampleRate = 1.0 / source.clip.frequency; //create a sorted copy with LINQ _notesByScoreTime = ActiveChart.Notes.OrderBy(o => o.Time.Seconds).ToList(); //NOTE: C# in-place sort: objListOrder.Sort((x, y) => x.OrderDate.CompareTo(y.OrderDate)); foreach (Note note in ActiveChart.Notes) { _noteSpawner.SpawnNote(note); yield return(null); } }
void SpawnAllNote() { note.Clear(); for (int i = 0; i < sheet.note.Count; i++) { note.Add(NoteSpawner.SpawnNote(spawnNotePrefab, sheet.note[i].enotePos, sheet.note[i].enoteType, sheet.note[i].noteTime, noteColor[(int)sheet.note[i].enotePos])); note[note.Count - 1].GetComponent <SpawnNote>().index = note.Count; note[note.Count - 1].name = "note" + note.Count; note[note.Count - 1].transform.parent = spawnNoteParent.transform; } isSheetLoad = false; }
//SpawnAllNote from G_sheetToPlay for Play void SpawnAllNote() { note.Clear(); for (int i = 0; i < GlobalInfo.G_sheetToPlay.note.Count; i++) { note.Add(NoteSpawner.SpawnNote(notePrefab, GlobalInfo.G_sheetToPlay.note[i].enotePos, GlobalInfo.G_sheetToPlay.note[i].enoteType, GlobalInfo.G_sheetToPlay.note[i].noteTime, noteColor[(int)GlobalInfo.G_sheetToPlay.note[i].enotePos])); note[note.Count - 1].name = "note" + note.Count; note[note.Count - 1].transform.parent = spawnNoteParent.transform; note[note.Count - 1].GetComponent<PlayNote>().manager = this; note[note.Count - 1].GetComponent<MeshRenderer>().enabled = false; note[note.Count - 1].GetComponent<PlayNote>().noteTime = GlobalInfo.G_sheetToPlay.note[note.Count-1].noteTime; totalScore += GlobalInfo.G_basicNoteScore * (1+((i+1.0f) / GlobalInfo.G_sheetToPlay.note.Count)) * GlobalInfo.G_scoreBonus; } }
protected virtual void SpawnNote(Note n, Vector3 pos, float scale) { noteSpawner.SpawnNote(n, pos, scale); }