Exemple #1
0
    private EditorNoteBase SpawnDragNote(float timestamp, int notePathId, float length, NoteDragType type, int endPath = -1)
    {
        Vector3        spawnPosition = new Vector3(NotePath.NotePaths[notePathId].transform.position.x, basePosition.y + 0.1f, basePosition.z);
        EditorNoteDrag note          = Instantiate(EditorNoteDragPrefab, spawnPosition, BoardObject.rotation).GetComponent <EditorNoteDrag>();

        note.Construct(timestamp, notePathId, endPath, length, type, spawnPosition);
        AddNoteToList(note);
        return(note);
    }
Exemple #2
0
    // Mouse Up event
    public void SetNote(int endPath, Vector3 point)
    {
        Debug.Log("Call Set Note");

        if (selectedNote == null)
        {
            return;
        }

        // Set the Hold Note length based on the mouse up
        if (selectedNoteType == NoteType.Hold || selectedNoteType == NoteType.Transition)
        {
            EditorNoteHold   temp      = selectedNote as EditorNoteHold;
            MeasureSeperator seperator = MeasureSeperatorManager.instance.FindClosestOffsetFromPoint(point);
            int   difference           = Mathf.RoundToInt(((seperator.timestamp - temp.offset) / EditorConductor.instance.spb) * 4f);
            float length = difference / 4f;
            temp.SetLength(length);
        }


        // Set the end path for flick note
        else if (selectedNoteType == NoteType.Flick)
        {
            if (Mathf.Abs(selectedNote.notePathId - endPath) != 1)
            {
                Debug.Log("Start: " + selectedNote.notePathId + ", End: " + endPath + ", Removing");
                RemoveNote(selectedNote);
                selectedNote = null;
                return;
            }
            EditorNoteFlick temp = selectedNote as EditorNoteFlick;
            temp.SetNote(endPath);
        }

        // Set the End locations and length for drag note
        else if (selectedNoteType == NoteType.Drag)
        {
            EditorNoteDrag   temp      = selectedNote as EditorNoteDrag;
            MeasureSeperator seperator = MeasureSeperatorManager.instance.FindClosestOffsetFromPoint(point);
            int   difference           = Mathf.RoundToInt(((seperator.timestamp - temp.offset) / EditorConductor.instance.spb) * 4f);
            float length = difference / 4f;
            temp.SetNote(length, endPath);
        }

        selectedNote = null;
    }