示例#1
0
    void Start()
    {
        base.OnStart();

        headNote         = CreateNote(colNum, NoteType.LONG_START) as SingleNote;
        tailNote         = CreateNote(colNum, NoteType.LONG_END) as SingleNote;
        headNote.hitTime = hitTime;
        tailNote.hitTime = hitTime + holdTime;

        slideScaleY = GameObject.Find("Slide").GetComponent <RectTransform>().localScale.y;
    }
示例#2
0
    /**
     * Remove a note being played
     * With this function we can forcely cancel a currently playing note
     */
    public void RemoveNote(SingleNote _note)
    {
        Debug.Log("Playing " + this.notePlaying.Count);

        this.notePlaying.ForEach(delegate(SingleNote note)
        {
            if (note.Note == _note.Note)
            {
                this.midiStreamSynthesizer.NoteOff(0, _note.Note);
                this.notePlaying.Remove(note);
            }
        });
    }
示例#3
0
    /**
     * Add a note to be played
     * With this function we can play multiple notes
     */
    public void AddNote(SingleNote note)
    {
        // Add a simple note and play it
        note.StartAt = Time.time;
        this.notePlaying.Add(note);

        Debug.Log("Playing " + this.notePlaying.Count + " to be played " + note.Note);

        if (note.Note >= 0)
        {
            // Begin to play
            midiStreamSynthesizer.NoteOn(0, note.Note, midiNoteVolume, midiInstrument);
        }
    }
示例#4
0
    void CreateNote(NoteDescriptor n)
    {
        switch (n.noteType)
        {
        case NoteType.Normal:
            // create a normal note at the center
            GameObject go   = Instantiate(singleNotePrefab) as GameObject;
            SingleNote note = go.GetComponent <SingleNote>();
            note.noteType   = NoteType.Normal;
            note.startTime  = currTime;
            note.arriveTime = n.arriveTime;
            note.angle_deg  = n.angle_deg;
            note.velocity   = ringRad / flyTime;
            note.time       = n.arriveTime;
            queues[(int)n.angle_deg / deg_perqueue].Enqueue(note);
            break;

        case NoteType.Long:
            go = Instantiate(longNotePrefab) as GameObject;
            LongNote ln = go.GetComponent <LongNote>();
            ln.noteType       = NoteType.Long;
            ln.startTime      = currTime;
            ln.headArriveTime = n.arriveTime;
            ln.tailArriveTime = n.endTime;
            ln.angle_deg      = n.angle_deg;
            ln.velocity       = ringRad / flyTime;
            ln.time           = n.arriveTime;
            queues[(int)n.angle_deg / deg_perqueue].Enqueue(ln);
            break;

        case NoteType.Special:
            go = Instantiate(specialNotePrefab) as GameObject;
            go.transform.parent = null;
            SpecialNote sn = go.GetComponent <SpecialNote>();
            sn.noteType   = NoteType.Special;
            sn.startTime  = currTime;
            sn.arriveTime = n.arriveTime;
            sn.angle_deg  = n.angle_deg;
            sn.velocity   = ringRad / flyTime;
            sn.time       = n.arriveTime;
            queues[(int)n.angle_deg / deg_perqueue].Enqueue(sn);
            break;

        default:
            break;
        }
    }
 public void ReturnBarToPool(SingleNote bar)
 {
     PoolManager.instance.ReturnPoolable(bar.GetComponent <Poolable>());
     m_ActiveBars.Remove(bar);
 }
示例#6
0
    void RecordNote(NoteCategory type)
    {
        var note = new SingleNote(recordingTimer, type);

        recording.InsertNote(note);
    }