Ejemplo n.º 1
0
        static public PhysicsShape RequestCustomShapeAccess(Sprite originalSprite)
        {
            PhysicsShape shape = null;

            bool exist = dictionary.TryGetValue(originalSprite, out shape);

            if (exist)
            {
                if (shape == null || shape.GetSprite().texture == null)
                {
                    dictionary.Remove(originalSprite);

                    shape = AddShape(originalSprite);

                    dictionary.Add(originalSprite, shape);
                }
                return(shape);
            }
            else
            {
                shape = AddShape(originalSprite);

                dictionary.Add(originalSprite, shape);

                return(shape);
            }
        }
Ejemplo n.º 2
0
        static public PhysicsShape RequesCustomShape(Sprite originalSprite)
        {
            if (originalSprite == null)
            {
                return(null);
            }

            PhysicsShape shape = null;

            bool exist = dictionary.TryGetValue(originalSprite, out shape);

            if (exist)
            {
                if (shape == null || shape.GetSprite().texture == null)
                {
                    shape = RequestCustomShapeAccess(originalSprite);
                }
                return(shape);
            }
            else
            {
                shape = RequestCustomShapeAccess(originalSprite);
                return(shape);
            }
        }