Example #1
0
        static int _m_FireTouchEvent(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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


            try {
                {
                    bool __cl_gen_ret = __cl_gen_to_be_invoked.FireTouchEvent(  );
                    LuaAPI.lua_pushboolean(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Example #2
0
        public bool GoToNpcPos(uint mapId, uint npcId, Task relateTask, uint npcExcelId = 0)
        {
            Actor localPlayer = Game.Instance.GetLocalPlayer();

            if (localPlayer == null)
            {
                return(false);
            }
            if (localPlayer.IsDead() == true)
            {
                return(false);
            }

            InstanceManager.Instance.IsAutoFighting = false;

            mCounter++;
            mTargetPathNodes.Clear();
            RunningTargetPathNode = null;

            if (mapId == SceneHelp.Instance.CurSceneID)
            {
                NpcPlayer targetNpc = null;
                if (relateTask != null && relateTask.CurrentGoal == GameConst.GOAL_INTERACT)
                {
                    targetNpc = NpcManager.Instance.GetNpcByNpcExcelId(npcExcelId);
                }
                if (targetNpc == null)
                {
                    targetNpc = NpcManager.Instance.GetNpcByNpcId(npcId);
                }

                NpcManager.Instance.NavigatingNpcId = npcId;

                if (targetNpc != null)
                {
                    if (targetNpc.IsLocalPlayerCloseEnoughToEnter)
                    {
                        bool touchRet = targetNpc.FireTouchEvent();
                        NpcManager.Instance.NavigatingNpcId = 0;
                        if (touchRet == true)
                        {
                            return(true);
                        }
                    }
                }

                TargetPathNode path = new TargetPathNode();
                path.SceneId     = SceneHelp.Instance.CurSceneID;
                path.LineId      = SceneHelp.Instance.CurLine;
                path.TargetNpcId = npcId;
                path.RelateTask  = relateTask;

                mTargetPathNodes.AddLast(path);

                return(true);
            }
            else
            {
                //TriggerCollider targetTrigger = TriggerManager.Instance.GetShortestPortalTrigger(mapId);

                //if(targetTrigger == null)
                //{
                //    targetTrigger = TriggerManager.Instance.GetShortestPortalTrigger(0);
                //}

                //if (targetTrigger != null)
                //{
                //    TargetPathNode path = new TargetPathNode();
                //    path.SceneId = SceneHelp.Instance.CurSceneID;
                //    path.TargetTriggerId = (uint)targetTrigger.TriggerInfo.Id;
                //    path.WantEnterMapId = mapId;
                //    path.RelateTask = relateTask;

                //    mTargetPathNodes.AddLast(path);
                //}

                TargetPathNode path2 = new TargetPathNode();
                path2.SceneId     = mapId;
                path2.LineId      = 0;
                path2.TargetNpcId = npcId;
                path2.RelateTask  = relateTask;

                mTargetPathNodes.AddLast(path2);

                // 如果没有找到传送门则直接传过去
                //if (targetTrigger == null)
                {
                    JumpToScene(true, mapId, 0, relateTask);
                }

                return(true);
            }
        }