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 UnGrab() { resizing = false; if (joint != null) { Destroy(joint); } float relativeBeat = (MAX_Z + transform.position.z) * zPerBeat; Debug.LogWarning("Relative - " + relativeBeat); relativeBeat = BeatMap.RoundToRelativeBeat(relativeBeat, BeatMap.currentNoteMode); BeatMap.SkipToBeat(relativeBeat); }
private void Update() { if (!initialized) { return; } if (IsGrabbed()) { if (transform.position.z > MAX_Z) { Vector3 newPosition = transform.position; newPosition.z = MAX_Z; transform.position = newPosition; } else if (transform.position.z < MIN_Z) { Vector3 newPosition = transform.position; newPosition.z = MIN_Z; transform.position = newPosition; } float relativeBeat = totalBeats - (transform.position.z / zPerBeat) - 45; relativeBeat = BeatMap.RoundToRelativeBeat(relativeBeat, BeatMap.currentNoteMode); currentTimeBar.GetComponentInChildren <Text>().text = (relativeBeat * totalBeats).ToString(); } else { currentTimeBar.GetComponentInChildren <Text>().text = BeatMap.GetMostRecentBeat.ToString(); } if (BeatMap.IsRunning()) { //Debug.Log("Current Beat - " + BeatMap.GetCurrentBeat() + " current Z - " //+ transform.position.z + " ZDiff - " + (MAX_Z-transform.position.z)); Vector3 newPosition = transform.position; newPosition.z = MAX_Z - (zPerBeat * BeatMap.GetCurrentBeat()); transform.position = newPosition; } if (changes.Count > 0) { //Debug.LogWarning("Changes detected - " + changes.Count); foreach (NoteDetails change in changes) { littleNoteMap[change].GetComponent <MeshRenderer>().enabled = !littleNoteMap[change].GetComponent <MeshRenderer>().enabled; Debug.LogWarning("Meshrendered inverted on game object " + littleNoteMap[change].name); } changes = new List <NoteDetails>(); } }