public void Launch(int index, NotesManager notesManager, SoundManager soundManager, NoteData fromNote, NoteData toNote)
        {
            this.index        = index;
            this.manager      = notesManager;
            this.soundManager = soundManager;
            this.fromNote     = fromNote;
            this.toNote       = toNote;
            this.y            = this.manager.from;

            this.prevFromNote = this.fromNote.Clone();
            this.prevToNote   = this.toNote.Clone();

            Mesh mesh = GetComponent <MeshFilter>().mesh;

            Vector3[] vertices = mesh.vertices;

            float PPS = (this.manager.to - this.manager.from) / this.manager.speed;

            vertices[0] = new Vector3((this.toNote.lane - this.fromNote.lane) * this.manager.lane_width - this.manager.lane_width / 2,
                                      -(this.toNote.time - this.fromNote.time) * PPS, 0f);
            vertices[3] = new Vector3(-this.manager.lane_width / 2, 0f, 0f);
            vertices[1] = new Vector3((this.toNote.lane - this.fromNote.lane) * this.manager.lane_width + this.manager.lane_width / 2,
                                      -(this.toNote.time - this.fromNote.time) * PPS, 0f);
            vertices[2] = new Vector3(this.manager.lane_width / 2, 0f, 0f);

            mesh.vertices = vertices;
            mesh.RecalculateBounds();

            BoxCollider collider = GetComponent <BoxCollider>();

            collider.center = new Vector3(this.manager.lane_width * ((this.toNote.lane - this.fromNote.lane - 1) / 2), (this.toNote.time - this.fromNote.time) / 2 * (Mathf.Abs(this.manager.to - this.manager.from) / this.manager.speed), 0f);
            collider.size   = new Vector3((Mathf.Abs(this.toNote.lane - this.fromNote.lane) + 1) * this.manager.lane_width, Mathf.Abs(this.toNote.time - this.fromNote.time) * (Mathf.Abs(this.manager.to - this.manager.from) / this.manager.speed), collider.size.z);

            this.transform.position = new Vector3(this.manager.lane_width * (this.fromNote.lane - 3), this.y, 0.0f);
        }
示例#2
0
        public void Launch(NotesManager notesManager, SoundManager soundManager, EditManager editManager, NoteData noteData)
        {
            this.manager      = notesManager;
            this.soundManager = soundManager;
            this.editManager  = editManager;
            this.data         = noteData;
            this.y            = this.manager.from + (this.manager.to - this.manager.from) * (this.CalcTime() / this.manager.speed);
            this.angle        = this.manager.from_angle;

            this.transform.position    = new Vector3(this.manager.lane_width * (this.data.lane - 3), this.y, this.transform.position.z);
            this.transform.eulerAngles = new Vector3(this.angle, 0.0f, 0.0f);
        }
        public void Launch(int index, NotesManager notesManager, SoundManager soundManager, NoteData note1, NoteData note2)
        {
            this.index        = index;
            this.manager      = notesManager;
            this.soundManager = soundManager;
            this.note1        = note1;
            this.note2        = note2;

            float x      = this.manager.lane_width * ((float)(this.note1.lane + this.note2.lane) / 2f - 3f);
            float y      = this.manager.from + (this.manager.to - this.manager.from) * (this.CalcTime() / this.manager.speed);
            float scaleX = (this.manager.lane_width / 10) * Mathf.Abs(this.note1.lane - this.note2.lane);

            this.transform.position   = new Vector3(x, y, this.transform.position.z);
            this.transform.localScale = new Vector3(scaleX, this.transform.localScale.y, this.transform.localScale.z);
        }