Ejemplo n.º 1
0
        public CollisionObject(ProxySprite proxySprite)
        {   // we'll pass in proxySprites to generate collision boxes around
            Debug.Assert(proxySprite != null);
            Sprite pSprite = proxySprite.pSprite;

            Debug.Assert(pSprite != null);
            this.pCollisionRect = new CollisionRect(pSprite.GetScreenRect());
            //Debug.WriteLine("ProxySprite Rect for {0}:({1},{2}),w:{3},h:{4}", proxySprite.pSprite.name, proxySprite.x, proxySprite.y, proxySprite.pSprite.pScreenRect.width, proxySprite.pSprite.pScreenRect.height);
            //Debug.WriteLine("CollisionRect for {0}:({1},{2}),w:{3},h:{4}", proxySprite.pSprite.name, this.pCollisionRect.x, this.pCollisionRect.y, this.pCollisionRect.width, this.pCollisionRect.height);
            this.pCollisionSpriteBox = SpriteBoxManager.Add(SpriteBaseName.Box, this.pCollisionRect);
            Debug.Assert(this.pCollisionSpriteBox != null);
            this.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Red).pAzulColor;
        }
Ejemplo n.º 2
0
        public ColObject(ProxySprite pProxySprite, BoxSprite.Name boxSpriteName)
        {
            Debug.Assert(pProxySprite != null);

            Sprite pSprite = pProxySprite.pSprite;

            Debug.Assert(pSprite != null);

            // Origin is in the UPPER RIGHT
            this.poColRect = new ColRect(pSprite.GetScreenRect());
            Debug.Assert(this.poColRect != null);

            this.pColSprite = ProxyBoxSpriteManager.Add(boxSpriteName);
            Debug.Assert(this.pColSprite != null);

            this.enabled = true;
        }
Ejemplo n.º 3
0
        public CollisionObject(SpriteProxy pSpriteProxy)
        {
            Debug.Assert(pSpriteProxy != null);

            // Create Collision Rect
            // Use the reference sprite to set size and shape
            Sprite pSprite = pSpriteProxy.GetSprite();

            Debug.Assert(pSprite != null);

            // Origin is in the UPPER RIGHT
            this.pCollisionRect = new CollisionRect(pSprite.GetScreenRect());
            Debug.Assert(this.pCollisionRect != null);

            // Create the sprite
            this.pCollisionSprite = SpriteBoxManager.Add(SpriteBox.Name.Box, this.pCollisionRect.x, this.pCollisionRect.y, this.pCollisionRect.width, this.pCollisionRect.height);
            Debug.Assert(this.pCollisionSprite != null);
            this.pCollisionSprite.SetLineColor(1.0f, 0.0f, 0.0f);
        }