#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 UnityEngineCharacterControllerWrap { public static void __Register(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(UnityEngine.CharacterController); Utils.BeginObjectRegister(type, L, translator, 0, 2, 12, 9); Utils.RegisterFunc(L, Utils.METHOD_IDX, "SimpleMove", _m_SimpleMove); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Move", _m_Move); Utils.RegisterFunc(L, Utils.GETTER_IDX, "velocity", _g_get_velocity); Utils.RegisterFunc(L, Utils.GETTER_IDX, "isGrounded", _g_get_isGrounded); Utils.RegisterFunc(L, Utils.GETTER_IDX, "collisionFlags", _g_get_collisionFlags); Utils.RegisterFunc(L, Utils.GETTER_IDX, "radius", _g_get_radius); Utils.RegisterFunc(L, Utils.GETTER_IDX, "height", _g_get_height); Utils.RegisterFunc(L, Utils.GETTER_IDX, "center", _g_get_center); Utils.RegisterFunc(L, Utils.GETTER_IDX, "slopeLimit", _g_get_slopeLimit); Utils.RegisterFunc(L, Utils.GETTER_IDX, "stepOffset", _g_get_stepOffset); Utils.RegisterFunc(L, Utils.GETTER_IDX, "skinWidth", _g_get_skinWidth); Utils.RegisterFunc(L, Utils.GETTER_IDX, "minMoveDistance", _g_get_minMoveDistance); Utils.RegisterFunc(L, Utils.GETTER_IDX, "detectCollisions", _g_get_detectCollisions); Utils.RegisterFunc(L, Utils.GETTER_IDX, "enableOverlapRecovery", _g_get_enableOverlapRecovery); Utils.RegisterFunc(L, Utils.SETTER_IDX, "radius", _s_set_radius); Utils.RegisterFunc(L, Utils.SETTER_IDX, "height", _s_set_height); Utils.RegisterFunc(L, Utils.SETTER_IDX, "center", _s_set_center); Utils.RegisterFunc(L, Utils.SETTER_IDX, "slopeLimit", _s_set_slopeLimit); Utils.RegisterFunc(L, Utils.SETTER_IDX, "stepOffset", _s_set_stepOffset); Utils.RegisterFunc(L, Utils.SETTER_IDX, "skinWidth", _s_set_skinWidth); Utils.RegisterFunc(L, Utils.SETTER_IDX, "minMoveDistance", _s_set_minMoveDistance); Utils.RegisterFunc(L, Utils.SETTER_IDX, "detectCollisions", _s_set_detectCollisions); Utils.RegisterFunc(L, Utils.SETTER_IDX, "enableOverlapRecovery", _s_set_enableOverlapRecovery); 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.CharacterController(); 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.CharacterController constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_SimpleMove(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); { UnityEngine.Vector3 _speed;translator.Get(L, 2, out _speed); var gen_ret = gen_to_be_invoked.SimpleMove( _speed ); LuaAPI.lua_pushboolean(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_Move(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); { UnityEngine.Vector3 _motion;translator.Get(L, 2, out _motion); var gen_ret = gen_to_be_invoked.Move( _motion ); 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 _g_get_velocity(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); translator.PushUnityEngineVector3(L, gen_to_be_invoked.velocity); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_isGrounded(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.isGrounded); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_collisionFlags(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.collisionFlags); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_radius(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.radius); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_height(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.height); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_center(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); translator.PushUnityEngineVector3(L, gen_to_be_invoked.center); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_slopeLimit(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.slopeLimit); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_stepOffset(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.stepOffset); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_skinWidth(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.skinWidth); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_minMoveDistance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushnumber(L, gen_to_be_invoked.minMoveDistance); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_detectCollisions(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.detectCollisions); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_enableOverlapRecovery(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.enableOverlapRecovery); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_radius(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); gen_to_be_invoked.radius = (float)LuaAPI.lua_tonumber(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_height(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); gen_to_be_invoked.height = (float)LuaAPI.lua_tonumber(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_center(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); UnityEngine.Vector3 gen_value;translator.Get(L, 2, out gen_value); gen_to_be_invoked.center = gen_value; } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_slopeLimit(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); gen_to_be_invoked.slopeLimit = (float)LuaAPI.lua_tonumber(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_stepOffset(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); gen_to_be_invoked.stepOffset = (float)LuaAPI.lua_tonumber(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_skinWidth(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); gen_to_be_invoked.skinWidth = (float)LuaAPI.lua_tonumber(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_minMoveDistance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); gen_to_be_invoked.minMoveDistance = (float)LuaAPI.lua_tonumber(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_detectCollisions(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); gen_to_be_invoked.detectCollisions = LuaAPI.lua_toboolean(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_enableOverlapRecovery(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.CharacterController gen_to_be_invoked = (UnityEngine.CharacterController)translator.FastGetCSObj(L, 1); gen_to_be_invoked.enableOverlapRecovery = LuaAPI.lua_toboolean(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } } }