Exemplo n.º 1
0
    void onClick_BtnAI_Btn(GameObject caster)
    {
        Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
        if (cs == null)
        {
            Engine.Utility.Log.Error("ExecuteCmd: ControllerSystem is null");
            return;
        }

        Client.ICombatRobot robot = cs.GetCombatRobot();
        if (robot.Status == Client.CombatRobotStatus.STOP)
        {
            ComBatCopyDataManager comBat = DataManager.Manager <ComBatCopyDataManager>();
            if (comBat.IsEnterCopy && comBat.EnterCopyID != 0)
            {
                robot.StartInCopy(comBat.EnterCopyID, comBat.LaskSkillWave, comBat.LastTransmitWave);
            }
            else
            {
                robot.Start();
            }
        }
        else
        {
            robot.Stop();
        }
    }
Exemplo n.º 2
0
    void AutoFindPath(Vector3 targetPos, uint npcID = 0, bool isNpc = false)
    {
        IController ctrl   = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl();
        IMapSystem  mapSys = ClientGlobal.Instance().GetMapSystem();

        if (mapSys == null)
        {
            return;
        }
        // 需要添加一个寻路的过程
        if (isNpc)
        {
            int mapID = DataManager.Manager <MapDataManager>().GetCurMapID();
            if (mapID > 0)
            {
                Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().VisiteNPC((uint)mapID, npcID, false);
                HideSelf();
            }
            else
            {
                Engine.Utility.Log.Error("mapid error ");
            }
        }
        else
        {
            if (ctrl != null)
            {
                Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
                if (cs != null)
                {
                    Client.ICombatRobot robot = cs.GetCombatRobot();
                    if (robot != null && robot.Status != CombatRobotStatus.STOP)
                    {
                        robot.Stop();
                    }
                }
                m_vecTargetPos = new Vector2(targetPos.x, targetPos.z);
                mapSys.AddFindPathCallback(FindPathCallBack);
                ctrl.MoveToTarget(targetPos, null, true);
                mapSys.RemoveFindPathCallback(FindPathCallBack);
            }
        }
    }