static public int GetPhysicsShapeCount(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.Sprite self = (UnityEngine.Sprite)checkSelf(l);
         var ret = self.GetPhysicsShapeCount();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int GetPhysicsShapeCount(IntPtr l)
 {
     try {
         UnityEngine.Sprite self = (UnityEngine.Sprite)checkSelf(l);
         var ret = self.GetPhysicsShapeCount();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #3
0
 static int QPYX_GetPhysicsShapeCount_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         UnityEngine.Sprite QPYX_obj_YXQP = (UnityEngine.Sprite)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.Sprite));
         int QPYX_o_YXQP = QPYX_obj_YXQP.GetPhysicsShapeCount();
         LuaDLL.lua_pushinteger(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
 static int GetPhysicsShapeCount(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.Sprite obj = (UnityEngine.Sprite)ToLua.CheckObject(L, 1, typeof(UnityEngine.Sprite));
         int o = obj.GetPhysicsShapeCount();
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #5
0
        private void Generate()
        {
            polygons = new List <Polygon2>();

                        #if UNITY_2017_4_OR_NEWER
            int count = sprite.GetPhysicsShapeCount();

            List <Vector2> points;
            Polygon2       newPolygon;

            for (int i = 0; i < count; i++)
            {
                points = new List <Vector2>();
                sprite.GetPhysicsShape(i, points);

                newPolygon = new Polygon2(points.ToArray());
                newPolygon.Normalize();

                polygons.Add(newPolygon);
            }
                        #endif
        }