void SectionJump(float direction) { // Jump to the previous or next sections float position = Mathf.Round(strikeLine.position.y); int i = 0; while (i < editor.currentSong.sections.Count && Mathf.Round(ChartEditor.WorldYPosition(editor.currentSong.sections[i])) <= position) { ++i; } // Jump forward if (direction > 0) { // Found section ahead if (i < editor.currentSong.sections.Count && Mathf.Round(ChartEditor.WorldYPosition(editor.currentSong.sections[i])) > position) { SetPosition(editor.currentSong.sections[i].tick); } else { SetPosition(editor.currentSong.TimeToTick(editor.currentSongLength, editor.currentSong.resolution)); // Jump to the end of the song } } // Jump backwards else { while (i > editor.currentSong.sections.Count - 1 || (i >= 0 && Mathf.Round(ChartEditor.WorldYPosition(editor.currentSong.sections[i])) >= position)) { --i; } if (i >= 0) { SetPosition(editor.currentSong.sections[i].tick); } else { SetPosition(0); } } }
public void UpdateSustainLength() { Note note = nCon.note; if (note.length != 0) { float lowerPos = ChartEditor.WorldYPosition(note); float higherPos = note.song.TickToWorldYPosition(note.tick + note.length); if (higherPos > editor.camYMax.position.y) { higherPos = editor.camYMax.position.y; } if (lowerPos < editor.camYMin.position.y) { lowerPos = editor.camYMin.position.y; } float length = higherPos - lowerPos; if (length < 0) { length = 0; } float centerYPos = (higherPos + lowerPos) / 2.0f; Vector3 scale = transform.localScale; scale.y = length; transform.localScale = scale; Vector3 position = nCon.transform.position; //position.y += length / 2.0f; position.y = centerYPos; transform.position = position; } else { transform.localScale = new Vector3(transform.localScale.x, 0, transform.localScale.z); } }
protected new void LateUpdate() { // Re-do the controller's position setting base.LateUpdate(); var events = editor.currentChart.events; float offset = ChartEventController.BASE_OFFSET; int index, length; SongObjectHelper.GetRange(events, chartEvent.tick, chartEvent.tick, out index, out length); // Determine the offset for the object for (int i = index; i < index + length; ++i) { if (events[i].GetType() != chartEvent.GetType()) { continue; } offset += ChartEventController.OFFSET_SPACING; } transform.position = new Vector3(SongObjectController.CHART_CENTER_POS + ChartEventController.position, ChartEditor.WorldYPosition(chartEvent), offset); }