Exemplo n.º 1
0
    public void PathInit()
    {
        if (!Life.ServerMode || m_parent.islocal)
        {
            Path.SetIndex(0);
            Path.Path = Path.SearchPath;
            //判断首个节点是否为楼梯
            PathData Road = Path.GetPathData(PathAccess.Cur);
            if (Road != null && Road.state == RoleState.STAIR)
            {
                m_Reject      = true;
                m_DoUpatePath = false;
            }

            //获取路线上的下一个攻击位,包含当前路径点
            ErrorInfo Error             = new ErrorInfo();
            PathData  NextAttackStation = Path.GetNextAttackPosCurInPath(ref Error);
            if (NextAttackStation != null)
            {
                m_AttackStation  = NextAttackStation.Road.GridPos;
                m_NAttackStation = NextAttackStation.Road.GridPos;
            }
            if (!Path.CheckHavePath())
            {
                return;
            }
        }
        m_parent.WaitServer = true;
        tga.SoldierRunRoadRequest srrr = new tga.SoldierRunRoadRequest();
        srrr.time             = new tga.tgaTime();
        srrr.time.Requesttime = Time.time;
        srrr.start            = new tga.GridPos();
        srrr.start.layer      = MapPos.Layer;
        srrr.start.unit       = MapPos.Unit;
        srrr.end       = new tga.GridPos();
        srrr.end.layer = Path.SearchPath[Path.SearchPath.Count - 1].Road.GridPos.Layer;
        srrr.end.unit  = Path.SearchPath[Path.SearchPath.Count - 1].Road.GridPos.Unit;
        for (int i = 0; i < Path.SearchPath.Count; i++)
        {
            srrr.roadlist.Add(Path.SearchPath[i].toPathRoad());
        }
        BSC.RunRoadRequest(m_parent.m_Core.m_DataID, srrr);
#if UNITY_EDITOR_LOG
        FileLog.write(m_parent.SceneID, "RunRoadRequest   " + Time.time, true);
#endif
    }
Exemplo n.º 2
0
    /// <summary>
    /// 炮弹兵请求寻路
    /// </summary>
    public static void DoRunRoadRequest(int DataID, tga.SoldierRunRoadRequest Info)
    {
        if (Info == null)
        {
            return;
        }
        UpdataLifeInfo(DataID, Info.info);
        BSsyncDTask task = new BSsyncDTask();

        task.cmd           = new BscCmd(DataID, BSCEventType.BSC_RunRoad);
        task.RemainingTime = Random.Range(0.01f, 0.1f);
        tga.SoldierRunRoadResponse sresponse = new tga.SoldierRunRoadResponse();
        sresponse.end   = Info.end;
        sresponse.start = Info.start;
        for (int i = 0; i < Info.roadlist.Count; i++)
        {
            sresponse.roadlist.Add(Info.roadlist[i]);
        }
        sresponse.time              = Info.time;
        sresponse.time.servertime   = Time.time;
        sresponse.time.Responsetime = sresponse.time.servertime + task.RemainingTime;
        task.Info = sresponse;
        m_lTask.Add(task);
    }
Exemplo n.º 3
0
 /// <summary>
 /// 炮弹兵请求寻路
 /// </summary>
 public static void RunRoadRequest(int DataID, tga.SoldierRunRoadRequest Info)
 {
     BSsyncD.DoRunRoadRequest(DataID, Info);
 }