Esempio n. 1
0
 protected void Rule_Default()
 {
     if (!inside && CheckCollisionZone(mainActor, OpenSpace.Collide.CollideType.ZDD))
     {
         inside = true;
         curr   = this;
         OnEnter();
     }
     else if (inside && !CheckCollisionZone(mainActor, OpenSpace.Collide.CollideType.ZDD))
     {
         inside = false;
         if (curr == this)
         {
             curr = null;
             cam.SetRule("Follow");
         }
         OnExit();
     }
 }
Esempio n. 2
0
        public Vision()
        {
            //------------------------------------------------------------
            // Khởi tạo Camera
            //------------------------------------------------------------
            GenCamera.Init_Acquisition(out HFramegrabber);

            //------------------------------------------------------------
            // Khởi tạo đối tượng đọc code
            //------------------------------------------------------------
            HDataCode2D_QRCode     = new HDataCode2D("QR Code", new HTuple(), new HTuple());
            HDataCode2D_DataMatrix = new HDataCode2D("Data Matrix ECC 200", new HTuple("default_parameters"), new HTuple("enhanced_recognition"));
            HBarcode = new HBarCode(new HTuple(), new HTuple());

            //------------------------------------------------------------
            // Load ROI đọc code của 3 loại code
            //------------------------------------------------------------
            HOperatorSet.SetSystem(new HTuple("clip_region"), new HTuple("false"));
            HOperatorSet.ReadRegion(out HRegion_QRCode, new HTuple("D:/Halcon/ROI_QR.hobj"));
            HOperatorSet.ReadRegion(out HRegion_DataMatrix, new HTuple("D:/Halcon/ROI_DM.hobj"));
            HOperatorSet.ReadRegion(out HRegion_Barcode, new HTuple("D:/Halcon/ROI_B39.hobj"));
        }
Esempio n. 3
0
        /// <summary>
        /// Draws the progress bar.
        /// </summary>
        /// <param name="camera">The camera used to draw.</param>
        public override void Draw(GenCamera camera)
        {
            if (_texture != null)
            {
                if ((camera != null) && !CanDraw(camera))
                    return;

                Vector2 drawPosition = (camera == null) ? _drawPosition : GetDrawPosition(camera);

                GenG.SpriteBatch.Draw(
                    _texture,
                    drawPosition,
                    _progressRect,
                    _color,
                    _rotation,
                    _origin,
                    Scale,
                    _spriteEffect,
                    0f);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Draws a box that represents the bounding box of the emitter in debug mode.
        /// </summary>
        /// <param name="camera">The camera used to draw.</param>
        public override void DrawDebug(GenCamera camera)
        {
            if ((camera != null) && !CanDraw(camera))
                return;

            GenG.SpriteBatch.Draw(
                GenG.Pixel,
                _position,
                _boundingRect,
                Color.BlueViolet * 0.5f);
        }
Esempio n. 5
0
        /// <summary>
        /// Draws a line between each node along the path.
        /// </summary>
        /// <param name="camera">The camera used to draw.</param>
        public override void DrawDebug(GenCamera camera)
        {
            if ((camera != null) && !CanDraw(camera))
                return;

            for (int i = 0; i < Nodes.Count - 1; i++)
                GenG.DrawLine(Nodes[i].Position, Nodes[i + 1].Position, Color.Lime * 0.5f, 1);
        }
Esempio n. 6
0
        /// <summary>
        /// Calls <c>Draw</c> on this verlet chain's group.
        /// Draws lines that represent each link constraint in the verlet chain.
        /// </summary>
        /// <param name="camera">The camera used to draw.</param>
        public override void Draw(GenCamera camera)
        {
            base.Draw(camera);

            if (DrawLines)
            {
                foreach (GenLink link in Links)
                    GenG.DrawLine(link.PointA.Position + link.OffsetA, link.PointB.Position + link.OffsetB, LineColor, LineThickness);
            }
        }