public ColObject(ProxySprite pProxySprite)
        {
            Debug.Assert(pProxySprite != null);

            // Create Collision Rect
            // Use the reference sprite to set size and shape
            // need to refactor if you want it different
            GameSprite pSprite = pProxySprite.pSprite;

            Debug.Assert(pSprite != null);

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

            // Create the box sprite

            //WORKING
            //this.pColSprite = BoxSpriteManager.Add(GameSprite.Name.Box, this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height);

            //TEST
            this.pColSprite = BoxSpriteManager.Add(pProxySprite.pSprite.GetName(), this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height);


            ////get the box name from the matching sprite name;
            //BoxSprite.Name colBoxName = (BoxSprite.Name) pProxySprite.pSprite.GetName();
            //Debug.Assert(colBoxName != null);
            //this.pColSprite = BoxSpriteManager.Find(colBoxName);
            //this.pColSprite.SetScreenRect(this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height);
            //Debug.Assert(this.pColSprite != null);

            this.pColSprite.SetLineColor(1.0f, 1.0f, 0.0f);
        }
Exemple #2
0
        //--------------------------------------------------------------------------------------------
        // Constructor
        //--------------------------------------------------------------------------------------------
        public CollisionObject(ProxySprite proxySprite)
        {
            Debug.Assert(proxySprite != null);

            GameSprite pSprite = proxySprite.pSprite;

            Debug.Assert(pSprite != null);

            this.pColRect = new CollisionRect(pSprite.GetScreenRect());
            Debug.Assert(this.pColRect != null);

            this.pBoxSprite = BoxSpriteManager.Add(BoxSprite.Name.CollisionBox, this.pColRect.x, this.pColRect.y, this.pColRect.width, this.pColRect.height);
            Debug.Assert(this.pBoxSprite != null);
            this.pBoxSprite.SetColor(1.0f, 1.0f, 1.0f);
        }
Exemple #3
0
        //----------------------------------------------------------------------------------
        // Data
        //----------------------------------------------------------------------------------
        //public BoxSprite pCollSprite;
        //public CollRect poColRect;


        //----------------------------------------------------------------------------------
        // Constructors
        //----------------------------------------------------------------------------------
        public NullCollisionObject(ProxySprite pProxySprite)
        {
            Debug.Assert(pProxySprite != null);

            GameSprite pGameSprite = pProxySprite.pSprite;

            Debug.Assert(pGameSprite != null);

            // Origin is in the upper-right
            this.poColRect = new CollRect(pGameSprite.GetScreenRect());
            Debug.Assert(this.poColRect != null);


            // Create the Sprite
            this.pCollSprite = BoxSpriteManager.Add(BoxSprite.Name.Box, this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height);
            Debug.Assert(this.pCollSprite != null);
            this.pCollSprite.SetLineColor(1.0f, 1.0f, 1.0f);
        }
Exemple #4
0
        public ColObject(ProxySprite pProxySprite)
        {
            Debug.Assert(pProxySprite != null);

            //use the Proxy's game Sprite for size and shape of collision rectangle
            GameSprite pSprite = pProxySprite.GetRealSprite();

            Debug.Assert(pSprite != null);

            //get the dimensions from the game sprite's rectangle
            // and store it in the collision rectangle
            this.poColRect = new ColRect(pSprite.GetScreenRect());
            Debug.Assert(this.poColRect != null);

            //create the collision sprite from the collision rectangle
            this.pColSprite = BoxSpriteMan.Add(BoxSprite.Name.BoxSprite1, this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height);
            Debug.Assert(this.pColSprite != null);
            this.pColSprite.SetLineColor(1.0f, 1.0f, 1.0f);
        }
Exemple #5
0
        public ColObject(ProxySprite pProxySprite)
        {
            Debug.Assert(pProxySprite != null);

            // Create Collision Rect
            // Use the reference sprite to set size and shape
            // need to refactor if you want it different
            GameSprite pSprite = pProxySprite.pSprite;

            Debug.Assert(pSprite != null);

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

            // Create the sprite
            this.pColSprite = BoxSpriteMan.Add(BoxSprite.Name.Box, this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height);
            Debug.Assert(this.pColSprite != null);
            this.pColSprite.SetLineColor(1.0f, 0.0f, 0.0f);
        }