310 lines
11 KiB
C#
310 lines
11 KiB
C#
#if USE_UNI_LUA
|
|
using LuaAPI = UniLua.Lua;
|
|
using RealStatePtr = UniLua.ILuaState;
|
|
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
|
|
#else
|
|
using LuaAPI = XLua.LuaDLL.Lua;
|
|
using RealStatePtr = System.IntPtr;
|
|
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
|
|
#endif
|
|
|
|
using XLua;
|
|
using System.Collections.Generic;
|
|
|
|
|
|
namespace XLua.CSObjectWrap
|
|
{
|
|
using Utils = XLua.Utils;
|
|
public class UnityEngineCollisionWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(UnityEngine.Collision);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 2, 10, 0);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetContact", _m_GetContact);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetContacts", _m_GetContacts);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "relativeVelocity", _g_get_relativeVelocity);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "rigidbody", _g_get_rigidbody);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "articulationBody", _g_get_articulationBody);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "body", _g_get_body);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "collider", _g_get_collider);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "transform", _g_get_transform);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "gameObject", _g_get_gameObject);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "contactCount", _g_get_contactCount);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "contacts", _g_get_contacts);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "impulse", _g_get_impulse);
|
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 1, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndClassRegister(type, L, translator);
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __CreateInstance(RealStatePtr L)
|
|
{
|
|
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
if(LuaAPI.lua_gettop(L) == 1)
|
|
{
|
|
|
|
var gen_ret = new UnityEngine.Collision();
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Collision constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetContact(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
int _index = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.GetContact( _index );
|
|
translator.Push(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_GetContacts(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 2&& translator.Assignable<UnityEngine.ContactPoint[]>(L, 2))
|
|
{
|
|
UnityEngine.ContactPoint[] _contacts = (UnityEngine.ContactPoint[])translator.GetObject(L, 2, typeof(UnityEngine.ContactPoint[]));
|
|
|
|
var gen_ret = gen_to_be_invoked.GetContacts( _contacts );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
if(gen_param_count == 2&& translator.Assignable<System.Collections.Generic.List<UnityEngine.ContactPoint>>(L, 2))
|
|
{
|
|
System.Collections.Generic.List<UnityEngine.ContactPoint> _contacts = (System.Collections.Generic.List<UnityEngine.ContactPoint>)translator.GetObject(L, 2, typeof(System.Collections.Generic.List<UnityEngine.ContactPoint>));
|
|
|
|
var gen_ret = gen_to_be_invoked.GetContacts( _contacts );
|
|
LuaAPI.xlua_pushinteger(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Collision.GetContacts!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_relativeVelocity(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
translator.PushUnityEngineVector3(L, gen_to_be_invoked.relativeVelocity);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_rigidbody(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.rigidbody);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_articulationBody(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.articulationBody);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_body(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.body);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_collider(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.collider);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_transform(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.transform);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_gameObject(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.gameObject);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_contactCount(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.contactCount);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_contacts(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.contacts);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_impulse(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.Collision gen_to_be_invoked = (UnityEngine.Collision)translator.FastGetCSObj(L, 1);
|
|
translator.PushUnityEngineVector3(L, gen_to_be_invoked.impulse);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|