예제 #1
0
        public static bool GetNpcPos(uint npcId, ref Vector3 result)
        {
            NpcPlayer npc = NpcManager.Instance.GetNpcByNpcId(npcId);

            if (npc != null)
            {
                result = npc.transform.position;
                return(true);
            }

            Neptune.NPC npcInfo = Neptune.DataManager.Instance.Data.GetNode <Neptune.NPC>((int)npcId);

            if (npcInfo != null)
            {
                result = npcInfo.Position;
                return(true);
            }

            return(false);
        }
예제 #2
0
        static int _m_InitNPCData(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            NpcPlayer __cl_gen_to_be_invoked = (NpcPlayer)translator.FastGetCSObj(L, 1);


            try {
                {
                    Neptune.NPC data = (Neptune.NPC)translator.GetObject(L, 2, typeof(Neptune.NPC));

                    __cl_gen_to_be_invoked.InitNPCData(data);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
예제 #3
0
    public void InitNPCData(Neptune.NPC data)
    {
        mNpcData         = data;
        gameObject.layer = LayerMask.NameToLayer("Npc");
        CanClickNPC      = true;

#if UNITY_EDITOR
        if (IsEscortNPC)
        {
            gameObject.name = "Npc_Escort_" + data.Id + "_" + data.ExcelId + "_" + ActorId + "_" + UID.obj_idx;
        }
        else
        {
            gameObject.name = "Npc_" + data.Id + "_" + data.ExcelId + "_" + ActorId + "_" + UID.obj_idx;
        }
#endif

        Stand();

        float radius = NpcHelper.MakeNpcDefine((uint)NpcData.ExcelId).Radius;
        mTouchSqrRadius = radius * radius;

        mOriginalDir = Trans.forward;
    }
예제 #4
0
 public UnitID CreateNPC(int npcId, Actor parent = null)
 {
     Neptune.NPC info = Neptune.DataManager.Instance.Data.GetNode <Neptune.NPC>(npcId);
     return(CreateNPC(info, parent));
 }
예제 #5
0
        static int _m_CreateNPC(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            xc.NpcManager __cl_gen_to_be_invoked = (xc.NpcManager)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <Actor>(L, 3))
                {
                    int   npcId  = LuaAPI.xlua_tointeger(L, 2);
                    Actor parent = (Actor)translator.GetObject(L, 3, typeof(Actor));

                    xc.UnitID __cl_gen_ret = __cl_gen_to_be_invoked.CreateNPC(npcId, parent);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2))
                {
                    int npcId = LuaAPI.xlua_tointeger(L, 2);

                    xc.UnitID __cl_gen_ret = __cl_gen_to_be_invoked.CreateNPC(npcId);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 3 && translator.Assignable <Neptune.NPC>(L, 2) && translator.Assignable <Actor>(L, 3))
                {
                    Neptune.NPC npcInfo = (Neptune.NPC)translator.GetObject(L, 2, typeof(Neptune.NPC));
                    Actor       parent  = (Actor)translator.GetObject(L, 3, typeof(Actor));

                    xc.UnitID __cl_gen_ret = __cl_gen_to_be_invoked.CreateNPC(npcInfo, parent);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 2 && translator.Assignable <Neptune.NPC>(L, 2))
                {
                    Neptune.NPC npcInfo = (Neptune.NPC)translator.GetObject(L, 2, typeof(Neptune.NPC));

                    xc.UnitID __cl_gen_ret = __cl_gen_to_be_invoked.CreateNPC(npcInfo);
                    translator.Push(L, __cl_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 xc.NpcManager.CreateNPC!"));
        }