Example #1
0
    static bool GameObject_CreatePrimitive__PrimitiveType(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 1)
        {
            UnityEngine.PrimitiveType arg0 = (UnityEngine.PrimitiveType)JSApi.getEnum((int)JSApi.GetType.Arg);
            JSMgr.datax.setObject((int)JSApi.SetType.Rval, UnityEngine.GameObject.CreatePrimitive(arg0));
        }

        return(true);
    }
Example #2
0
 static int CreatePrimitive(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.PrimitiveType arg0 = (UnityEngine.PrimitiveType)ToLua.CheckObject(L, 1, typeof(UnityEngine.PrimitiveType));
         UnityEngine.GameObject    o    = UnityEngine.GameObject.CreatePrimitive(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #3
0
 public static int CreatePrimitive_wrap(long L)
 {
     try
     {
         UnityEngine.PrimitiveType arg0 = (UnityEngine.PrimitiveType)(FCLibHelper.fc_get_int(L, 0));
         UnityEngine.GameObject    ret  = UnityEngine.GameObject.CreatePrimitive(arg0);
         long ret_ptr = FCLibHelper.fc_get_return_ptr(L);
         long v       = FCGetObj.PushObj(ret);
         FCLibHelper.fc_set_value_wrap_objptr(ret_ptr, v);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
        private void Update()
        {
            // Saves on garbage collection
            if (mesh == meshFilter.mesh)
            {
                return;
            }

            var meshName = meshFilter.mesh.name;

            if (meshName.StartsWith("Sphere"))
            {
                component.primitiveType = PrimitiveType.Sphere;
            }
            else if (meshName.StartsWith("Capsule"))
            {
                component.primitiveType = PrimitiveType.Capsule;
            }
            else if (meshName.StartsWith("Cylinder"))
            {
                component.primitiveType = PrimitiveType.Cylinder;
            }
            else if (meshName.StartsWith("Cube"))
            {
                component.primitiveType = PrimitiveType.Cube;
            }
            else if (meshName.StartsWith("Plane"))
            {
                component.primitiveType = PrimitiveType.Plane;
            }
            else if (meshName.StartsWith("Quad"))
            {
                component.primitiveType = PrimitiveType.Quad;
            }

            value = (UnityPrimitiveType)(int)component.primitiveType;
            mesh  = meshFilter.mesh;
        }