コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #4
0
ファイル: Board.cs プロジェクト: hirotk/Pentia
 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;
 }