public static NoteDetails[] GenerateNotesForNewMap(BeatMap.NoteMode modeToGenerate, int totalBeats) { Debug.Log("Generating notes for new map, #Beats-" + totalBeats + " Mode-" + modeToGenerate); int numberOfNotesToGenerate = (12 * totalBeats); numberOfNotesToGenerate = (int)(numberOfNotesToGenerate * Note.GetFactor(modeToGenerate)); NoteDetails[] notes = new NoteDetails[numberOfNotesToGenerate]; for (int count = 0; count < numberOfNotesToGenerate; count++) { notes[count] = new NoteDetails(); int offSet = count % 12; int y = offSet / 4; int x = offSet % 4; Vector2 gridPosition = new Vector2(x, y); notes[count].gridPosition = gridPosition; notes[count].color = Note.NoteColor.NONE; notes[count].slashDirection = Note.SlashDirection.NONE; float spawnTime = (int)(count / 12f) / Note.GetFactor(modeToGenerate); float factor = Note.GetFactor(modeToGenerate); spawnTime = BeatMap.RoundToRelativeBeat(spawnTime, modeToGenerate); notes[count].timeToSpawn = spawnTime; } return(notes); }
public void OnNewValuesChanged() { selectedMode = (BeatMap.NoteMode)noteModeDropDown.value; selectedAudioPath = audioPathTextBox.text; selecedNewSongFileName = Path.GetFileName(selectedAudioPath); try { selectedBPM = float.Parse(bpmTextBox.text); } catch (FormatException e) { } selectedNewSongName = newSongNameTextBox.text; selectedMapArtist = mapArtistTextBox.text; selectedSongArtist = songArtistTextBox.text; selectedDifficulty = (BeatSaveDifficulty)newDifficultyDropdown.value; }
public static NoteDetails[] InvertNoteArray(NoteDetails[] original, int totalBeats , BeatMap.NoteMode mode) { NoteDetails[] filled = GenerateNotesForNewMap(mode, totalBeats); List <NoteDetails> delta = new List <NoteDetails>(); for (int count = 0; count < filled.Length; count++) { if (!hasNoteWithSamePosition(filled[count], original)) { delta.Add(filled[count]); } } Debug.LogWarning("Inverted size - " + delta.Count); return(delta.ToArray()); }
public static float GetFactor(BeatMap.NoteMode mode) { if (mode == BeatMap.NoteMode.HalfNote) { return(2); } else if (mode == BeatMap.NoteMode.QuarterNote) { return(4); } else if (mode == BeatMap.NoteMode.WholeNote) { return(1); } else if (mode == BeatMap.NoteMode.DoubleNote) { return(.5f); } else { return(8); } }