public bool CheckParts(GameObj inObj)
        {
            ListNode ptr = (ListNode)ShieldParts.getActiveHead();

            while (ptr != null)
            {
                ShieldPart temp = (ShieldPart)ptr.getData();

                if (temp.iSCollide(inObj.getCollisionObjRectangle()))
                {
                    temp.Health--;
                    switch (temp.Health)
                    {
                    case 3:
                        temp.FlipSprite(SpriteName.ShieldPart2);
                        break;

                    case 2:
                        temp.FlipSprite(SpriteName.ShieldPart3);
                        break;

                    default:
                        ShieldParts.Remove(ptr);
                        GameObjMananger.getInstance().KillObject((ShieldPart)ptr.getData(), SpriteBatchName.Shields);

                        UpdateSize();
                        break;
                    }
                    return(true);
                }

                ptr = (ListNode)ptr.pNext;
            }
            return(false);
        }
Example #2
0
        private bool isCollide(GameObj ObjA, GameObj ObjB)
        {
            Rectangle RectA = ObjA.getCollisionObjRectangle();
            Rectangle RectB = ObjB.getCollisionObjRectangle();

            return(RectA.Intersects(RectB));
        }