Example #1
0
        private Piece createPiece(Field field, int x, int y, PcType type = PcType.Random)
        {
            if (type == PcType.Random)
            {
                type = (PcType)rand.Next((int)PcType.Leng);
            }
            var piece = new Piece(field, x, y, type);

            field.PutPiece(piece);
            return(piece);
        }
Example #2
0
        public bool Move(Direction direction)
        {
            Field.RemovePiece(this);
            bool moved = false;

            if (canMove(direction))
            {
                Mover.Move(ref pos, direction);
                moved = true;
            }

            Field.PutPiece(this);
            Field.Draw();
            return(moved);
        }
Example #3
0
        public bool Rotate(RtDirection direction)
        {
            Field.RemovePiece(this);
            bool rotated = false;

            if (canRotate(direction))
            {
                Rotator.Rotate(Shape, direction);
                rotated = true;
            }

            Field.PutPiece(this);
            Field.Draw();
            return(rotated);
        }
Example #4
0
 private Piece createPiece(Field field, int x, int y, PcType type = PcType.Random)
 {
     if (type == PcType.Random) { type = (PcType)rand.Next((int)PcType.Leng); }
     var piece = new Piece(field, x, y, type);
     field.PutPiece(piece);
     return piece;
 }