예제 #1
0
        public void DoMotion(Board board, MotionSide side)
        {
            Motion moving = new Motion(side);

            // Setting figure to board
            if (side == MotionSide.Bottom && CheckMotion(board, side) == false)
            {
                this.isSet = true;
                for (int x = 0; x < state.currentState.width; x++)
                {
                    for (int y = 0; y < state.currentState.height; y++)
                    {
                        board.matrix[x + this.anchor.X, y + this.anchor.Y] = true;
                    }
                }
            }
            if (CheckMotion(board, side) == true)
            {
                this.anchor.X += moving.dx;
                this.anchor.Y += moving.dy;

                if (side == MotionSide.Rotate)
                {
                    this.state = this.state.nextState;
                }
            }
        }
예제 #2
0
 public Figure()
 {
     anchor = new Position(0, 0);
     state  = new FigurePhase(new Board(0, 0), this.state);
 }
예제 #3
0
 public FigurePhase(Board b, FigurePhase next)
 {
     currentState = b;
     nextState    = next;
 }