Esempio n. 1
0
        public static void GetEx(this ObjectTranslator t, RealStatePtr L, int index, out Core.Math.Vec3 val)
        {
            LuaTypes type = LuaAPI.lua_type(L, index);

            if (type == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != CoreMathVec3_TypeID)
                {
                    throw new Exception("invalid userdata for Core.Math.Vec3");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!PackUnpack.UnPack(buff, 0, out val))
                {
                    throw new Exception("unpack fail for Core.Math.Vec3");
                }
            }
            else if (type == LuaTypes.LUA_TTABLE)
            {
                PackUnpack.UnPack(t, L, index, out val);
            }
            else
            {
                val = (Core.Math.Vec3)t.objectCasters.GetCaster(typeof(Core.Math.Vec3))(L, index, null);
            }
        }
Esempio n. 2
0
        static int _m_RandomPoint(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Logic.Battle __cl_gen_to_be_invoked = (Logic.Battle)translator.FastGetCSObj(L, 1);



                {
                    Core.Math.Vec3 center; translator.Get(L, 2, out center);
                    float          range = (float)LuaAPI.lua_tonumber(L, 3);

                    Core.Math.Vec3 __cl_gen_ret = __cl_gen_to_be_invoked.RandomPoint(center, range);
                    translator.PushCoreMathVec3(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 3
0
        public static bool Pack(IntPtr buff, int offset, Core.Math.Vec3 field)
        {
            if (!LuaAPI.xlua_pack_float3(buff, offset, field.x, field.y, field.z))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 4
0
        public static void PushCoreMathVec3(this ObjectTranslator t, RealStatePtr L, Core.Math.Vec3 val)
        {
            if (CoreMathVec3_TypeID == -1)
            {
                bool is_first;
                CoreMathVec3_TypeID = t.getTypeId(L, typeof(Core.Math.Vec3), out is_first);
            }

            IntPtr buff = LuaAPI.xlua_pushstruct(L, 12, CoreMathVec3_TypeID);

            if (!PackUnpack.Pack(buff, 0, val))
            {
                throw new Exception("pack fail fail for Core.Math.Vec3 ,value=" + val);
            }
        }
Esempio n. 5
0
        static int _m_ClosestPoint(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Core.Math.Bounds __cl_gen_to_be_invoked; translator.Get(L, 1, out __cl_gen_to_be_invoked);


                int __gen_param_count = LuaAPI.lua_gettop(L);

                if (__gen_param_count == 2 && translator.Assignable <Core.Math.Vec3>(L, 2))
                {
                    Core.Math.Vec3 point; translator.Get(L, 2, out point);

                    Core.Math.Vec3 __cl_gen_ret = __cl_gen_to_be_invoked.ClosestPoint(point);
                    translator.PushCoreMathVec3(L, __cl_gen_ret);


                    translator.UpdateCoreMathBounds(L, 1, __cl_gen_to_be_invoked);


                    return(1);
                }
                if (__gen_param_count == 2 && translator.Assignable <Core.Math.Vec3>(L, 2))
                {
                    Core.Math.Vec3 point; translator.Get(L, 2, out point);
                    float          distance;

                    Core.Math.Vec3 __cl_gen_ret = __cl_gen_to_be_invoked.ClosestPoint(point, out distance);
                    translator.PushCoreMathVec3(L, __cl_gen_ret);
                    LuaAPI.lua_pushnumber(L, distance);



                    translator.UpdateCoreMathBounds(L, 1, __cl_gen_to_be_invoked);


                    return(2);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to Core.Math.Bounds.ClosestPoint!"));
        }
Esempio n. 6
0
        public static bool UnPack(IntPtr buff, int offset, out Core.Math.Vec3 field)
        {
            field = default(Core.Math.Vec3);

            float x = default(float);
            float y = default(float);
            float z = default(float);

            if (!LuaAPI.xlua_unpack_float3(buff, offset, out x, out y, out z))
            {
                return(false);
            }
            field.x = x;
            field.y = y;
            field.z = z;


            return(true);
        }
Esempio n. 7
0
        public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Core.Math.Vec3 val)
        {
            val = new Core.Math.Vec3();
            int top = LuaAPI.lua_gettop(L);

            if (Utils.LoadField(L, idx, "x"))
            {
                translator.Get(L, top + 1, out val.x);
            }
            LuaAPI.lua_pop(L, 1);

            if (Utils.LoadField(L, idx, "y"))
            {
                translator.Get(L, top + 1, out val.y);
            }
            LuaAPI.lua_pop(L, 1);

            if (Utils.LoadField(L, idx, "z"))
            {
                translator.Get(L, top + 1, out val.z);
            }
            LuaAPI.lua_pop(L, 1);
        }
Esempio n. 8
0
        static int _m_SampleNavPosition(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Logic.Battle __cl_gen_to_be_invoked = (Logic.Battle)translator.FastGetCSObj(L, 1);



                {
                    Core.Math.Vec3 searchPoint; translator.Get(L, 2, out searchPoint);

                    Core.Math.Vec3 __cl_gen_ret = __cl_gen_to_be_invoked.SampleNavPosition(searchPoint);
                    translator.PushCoreMathVec3(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 9
0
        static int _m_VectorToLocal(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                Logic.Controller.Entity __cl_gen_to_be_invoked = (Logic.Controller.Entity)translator.FastGetCSObj(L, 1);



                {
                    Core.Math.Vec3 point; translator.Get(L, 2, out point);

                    Core.Math.Vec3 __cl_gen_ret = __cl_gen_to_be_invoked.VectorToLocal(point);
                    translator.PushCoreMathVec3(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Esempio n. 10
0
        public static void UpdateCoreMathVec3(this ObjectTranslator t, RealStatePtr L, int index, Core.Math.Vec3 val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != CoreMathVec3_TypeID)
                {
                    throw new Exception("invalid userdata for Core.Math.Vec3");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!PackUnpack.Pack(buff, 0, val))
                {
                    throw new Exception("pack fail for Core.Math.Vec3 ,value=" + val);
                }
            }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }