Esempio n. 1
0
        public bool GoToTagPos(uint mapId, uint tagId, Task relateTask, System.Action finishedCallback = null)
        {
            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)
            {
                Neptune.Tag tagInfo = Neptune.DataManager.Instance.Data.GetNode <Neptune.Tag>((int)tagId);

                if (tagInfo != null)
                {
                    TargetPathNode path = new TargetPathNode();
                    path.SceneId          = SceneHelp.Instance.CurSceneID;
                    path.LineId           = SceneHelp.Instance.CurLine;
                    path.TargetTagId      = tagId;
                    path.RelateTask       = relateTask;
                    path.FinishedCallback = finishedCallback;

                    mTargetPathNodes.AddLast(path);

                    return(true);
                }
            }
            else
            {
                TargetPathNode path2 = new TargetPathNode();
                path2.SceneId          = mapId;
                path2.LineId           = 0;
                path2.TargetTagId      = tagId;
                path2.RelateTask       = relateTask;
                path2.FinishedCallback = finishedCallback;

                mTargetPathNodes.AddLast(path2);

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

            return(false);
        }
Esempio n. 2
0
        public bool GoToMonsterPos(uint mapId, uint monsterId, Task relateTask)
        {
            Actor localPlayer = Game.Instance.GetLocalPlayer();

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

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

            if (mapId == SceneHelp.Instance.CurSceneID)
            {
                List <Vector3> monsterPositions = xc.Dungeon.LevelObjectHelper.GetMonsterPositionsByActorId(monsterId);

                if (monsterPositions.Count > 0)
                {
                    TargetPathNode path = new TargetPathNode();
                    path.SceneId         = SceneHelp.Instance.CurSceneID;
                    path.LineId          = SceneHelp.Instance.CurLine;
                    path.TargetMonsterId = monsterId;
                    path.RelateTask      = relateTask;

                    mTargetPathNodes.AddLast(path);

                    return(true);
                }
                else
                {
                    GameDebug.LogWarning("Can not find monster " + monsterId + "(actor id) in instance " + mapId);
                }
            }
            else
            {
                //TriggerCollider 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.TargetMonsterId = monsterId;
                path2.RelateTask      = relateTask;

                mTargetPathNodes.AddLast(path2);

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

            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// 去某个副本的怪物
        /// </summary>
        /// <param name="mapId">要进入这个副本的大地图的trigger ID</param>
        /// <param name="instanceId">要进入这个副本的ID</param>
        /// <param name="monsterId">要找寻的这个怪物ID</param>
        /// <returns></returns>
        public bool GoToMonsterPos(uint mapId, uint instanceId, uint monsterId, Task relateTask)
        {
            Actor localPlayer = Game.Instance.GetLocalPlayer();

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

            InstanceManager.Instance.IsAutoFighting = false;

            if (instanceId <= 0)
            {
                return(GoToMonsterPos(mapId, monsterId, relateTask));
            }

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

            // 如果已经在这个大地图
            if (mapId == SceneHelp.Instance.CurSceneID)
            {
                // 防止策划配错表
                uint realInstanceId = 0;

                //TriggerCollider targetTrigger = TriggerManager.Instance.GetShortestPortalTrigger(instanceId);

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

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

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

                realInstanceId = instanceId;

                TargetPathNode node2 = new TargetPathNode();
                node2.SceneId         = realInstanceId;
                node2.LineId          = 0;
                node2.TargetMonsterId = monsterId;
                node2.RelateTask      = relateTask;

                mTargetPathNodes.AddLast(node2);

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

                return(false);
            }
            // 如果已经在这个副本
            else if (instanceId == SceneHelp.Instance.CurSceneID)
            {
                List <Vector3> monsterPositions = xc.Dungeon.LevelObjectHelper.GetMonsterPositionsByActorId(monsterId);

                if (monsterPositions.Count > 0)
                {
                    TargetPathNode path = new TargetPathNode();
                    path.SceneId         = SceneHelp.Instance.CurSceneID;
                    path.LineId          = SceneHelp.Instance.CurLine;
                    path.TargetMonsterId = monsterId;
                    path.RelateTask      = relateTask;

                    mTargetPathNodes.AddLast(path);

                    return(true);
                }
            }
            // 如果什么都不在
            else
            {
                //TriggerCollider shortestTrigger = TriggerManager.Instance.GetShortestPortalTrigger(0);

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

                //    mTargetPathNodes.AddLast(path);

                //    path = new TargetPathNode();
                //    path.SceneId = mapId;
                //    path.WantEnterMapId = instanceId;
                //    path.RelateTask = relateTask;

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

                TargetPathNode path2 = new TargetPathNode();
                path2.SceneId         = instanceId;
                path2.LineId          = 0;
                path2.TargetMonsterId = monsterId;
                path2.RelateTask      = relateTask;

                mTargetPathNodes.AddLast(path2);

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

            return(false);
        }
Esempio n. 4
0
        /// <summary>
        /// 寻路去副本
        /// </summary>
        public bool GoToInstance(uint entranceMapId, uint instanceId, Task relateTask)
        {
            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 (entranceMapId == SceneHelp.Instance.CurSceneID)
            {
                //TriggerCollider targetTrigger = TriggerManager.Instance.GetShortestPortalTrigger(instanceId);

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

                //    if(targetTrigger == null)
                //    {
                //        return false;
                //    }
                //}

                //TargetPathNode node = new TargetPathNode();
                //node.SceneId = entranceMapId;
                //node.TargetTriggerId = (uint)targetTrigger.TriggerInfo.Id;
                //node.RelateTask = relateTask;

                //mTargetPathNodes.AddLast(node);
            }
            else
            {
                //TriggerCollider targetTrigger = TriggerManager.Instance.GetShortestPortalTrigger(0);

                //if(targetTrigger == null)
                //{
                //    return false;
                //}

                //TargetPathNode path = new TargetPathNode();
                //path.SceneId = SceneHelp.Instance.CurSceneID;
                //path.TargetTriggerId = (uint)targetTrigger.TriggerInfo.Id;
                //path.WantEnterMapId = entranceMapId;
                //path.RelateTask = relateTask;

                //mTargetPathNodes.AddLast(path);

                TargetPathNode path2 = new TargetPathNode();
                path2.SceneId        = entranceMapId;
                path2.LineId         = 0;
                path2.WantEnterMapId = instanceId;
                path2.RelateTask     = relateTask;

                mTargetPathNodes.AddLast(path2);
            }

            return(false);
        }
Esempio n. 5
0
        /// <summary>
        /// 移动到目标点
        /// </summary>
        public bool GoToConstPosition(uint mapId, uint line, Vector3 pos, Task relateTask, System.Action finishedCallback)
        {
            Actor localPlayer = Game.Instance.GetLocalPlayer();

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

            // 记录当弹出退出提示的时候是否要继续自动战斗
            if (SceneHelp.Instance.IsInInstance == true || SceneHelp.Instance.IsCanExitBtnInWild == true)
            {
                SceneHelp.Instance.IsAutoFightingWhenShowExitTips = InstanceManager.Instance.IsAutoFighting || SceneHelp.Instance.IsAutoFightingWhenShowExitTips;
            }

            InstanceManager.Instance.IsAutoFighting = false;

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

            if (mapId == SceneHelp.Instance.CurSceneID &&
                (line == SceneHelp.Instance.CurLine || SceneHelp.Instance.IsInWorldBossFirstInstance))
            {
                TargetPathNode path = new TargetPathNode();
                path.SceneId          = SceneHelp.Instance.CurSceneID;
                path.LineId           = SceneHelp.Instance.CurLine;
                path.TargetConstPos   = pos;
                path.RelateTask       = relateTask;
                path.FinishedCallback = finishedCallback;

                mTargetPathNodes.AddLast(path);
            }
            else
            {
                //TriggerCollider targetTrigger = TriggerManager.Instance.GetShortestPortalTrigger(mapId);

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

                //    if (targetTrigger == null)
                //    {
                //        return false;
                //    }
                //}

                //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           = line;
                path2.TargetConstPos   = pos;
                path2.RelateTask       = relateTask;
                path2.FinishedCallback = finishedCallback;

                mTargetPathNodes.AddLast(path2);

                JumpToScene(false, mapId, line, relateTask);
            }

            TaskManager.Instance.NavigatingTask = null;

            return(true);
        }
Esempio n. 6
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);
            }
        }