예제 #1
0
 public Piece(Note note, PieceData data, int stepOffset)
 {
     this.note       = note;
     _data           = data;
     this.stepOffset = stepOffset;
     position        = new Vector2(data.positionX, GridUtility.StepToPositionY(stepOffset + 16 - note.grid.stepOffset));
 }
예제 #2
0
        public Note(Grid grid, NoteData data, int stepOffset)
        {
            this.grid       = grid;
            _data           = data;
            this.stepOffset = stepOffset;
            position        = new Vector2(_data.pieces[0].positionX, GridUtility.StepToPositionY(stepOffset + 16 - grid.stepOffset));
            direction       = GridUtility.StepToDirection(stepOffset + 16 - grid.stepOffset);
            int   pieceStepOffset = stepOffset;
            Piece previousPiece   = null;

            foreach (var pieceData in _data.pieces)
            {
                Piece piece;
                switch (data.beatingStyle)
                {
                case BeatingStyleType.Click:
                    piece = new ClickPiece(this, pieceData, pieceStepOffset);
                    break;

                case BeatingStyleType.Hold:
                    piece = new HoldPiece(this, pieceData, pieceStepOffset);
                    break;

                case BeatingStyleType.SpecialHold:
                    piece = new SpecialHoldPiece(this, pieceData, pieceStepOffset);
                    break;

                case BeatingStyleType.Drag:
                    piece = new DragPiece(this, pieceData, pieceStepOffset);
                    break;

                case BeatingStyleType.Flick:
                    piece = new FlickPiece(this, pieceData, pieceStepOffset);
                    break;

                default:
                    throw new Exception();
                }
                if (previousPiece != null)
                {
                    piece.previous     = previousPiece;
                    previousPiece.next = piece;
                }
                pieceStepOffset += piece.tempo;
                _pendingPieces.Enqueue(piece);
                previousPiece = piece;
            }
        }