Beispiel #1
0
    public bool CheckAttackPos()
    {
        MapGrid attackstation = MapGrid.GetMG(m_AttackStation);

        if (NdUtil.IsSameMapPos(MapPos, m_AttackStation) && attackstation.IsAttackStations())
        {
            List <int> samelist   = new List <int>();
            List <int> unsamelist = new List <int>();
            attackstation.GetCampRoleList(m_parent.m_Core.m_Camp, ref samelist, ref unsamelist);
            if (unsamelist.Count > 0)
            {
                if (!m_FindAttackpos)
                {
#if UNITY_EDITOR_LOG
                    FileLog.write(m_SceneID, "CheckAttackPos" + Path.Indext + "," + m_ForceGrid + "," + m_NGrid + "," + MapPos + "," + m_AttackStation + "," + m_NAttackStation
                                  + "," + m_Attack + "," + RoleParent.m_Skill.CanAttack() + "," + Time.realtimeSinceStartup);
#endif
                    m_FindAttackpos = true;

                    (m_parent as Role).ChangeTarget(ChangeTargetReason.ClearTarget, null);
                    MapGrid g = GetCanAttackStation();
                    if (g != null && (!Life.ServerMode || !m_parent.WaitServer))
                    {
                        ClearPath();
                        Path.PathAI(m_SceneID, MapGrid.GetMG(MapPos), g, m_parent.m_Attr as RoleAttribute, CurrentGS, WalkDIR);
                        PathInit();
                    }
                    else
                    {
#if UNITY_EDITOR_LOG
                        //Debug.Log("没有空闲攻击位 " + MapPos );
#endif
                    }

                    /*//判断首个节点是否为楼梯
                     * 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;
                     * }*/

                    FirstCheckAttack();
                }
                return(false);
            }
        }
        return(true);
    }
Beispiel #2
0
 /// <summary>
 /// 是否在路径上
 /// </summary>
 public bool InRoad(Int2 pos)
 {
     for (int i = m_Index; i < PathCount; i++)
     {
         if (NdUtil.IsSameMapPos(pos, Path[i].Road.GridPos) == true)
         {
             return(true);
         }
     }
     if (PathCount <= 0)
     {
         return(true);
     }
     return(false);
 }
Beispiel #3
0
    //取下一个动作
    public GridActionCmd GetNextAction()
    {
        Vector3 pos    = RoleParent.m_thisT.localPosition;
        float   cdtime = RoleParent.CDTime;
        //int bodyradius = RoleParent.m_Attr.Radius;
        RoleSkill     roleskill = RoleParent.m_Skill as RoleSkill;
        GridActionCmd action    = null;

        m_IndexAdd = false;
        if (RoleParent.isDead)
        {
            action = new GridActionCmdDie(pos, 3 * 60 * 60f, WalkDIR, RankDeep);
            action.SetTarget(RoleParent);
            m_Reject = false;
            return(action);
        }


        if (RoleParent == null || RoleParent.m_Attr == null)
        {
            action = new GridActionCmdStand();
            action.SetData(pos, pos, RoleState.STAND, Time.deltaTime, -1, WalkDIR, RankDeep);
            action.SetTarget(RoleParent);
            return(action);
        }

        if (m_bForce == 0)
        {
            action = new GridActionCmdSpecialJump(0.5f, MapGrid.GetMG(MapPos).pos, MapGrid.GetMG(m_ForceGrid).pos, m_ForceDir, RankDeep);
            action.SetTarget(RoleParent);
            m_bForce = -1;
            SetUpdataPath(new AIEventData(AIEvent.EVENT_MAP));
            m_NGrid = m_ForceGrid;
            if (MapGrid.GetMG(MapPos).PropStations == StationsProp.ATTACK)
            {
                m_AttackStation  = MapPos;
                m_NAttackStation = MapPos;
            }
            MapPos        = m_NGrid;
            WalkDIR       = m_ForceDir;
            m_Reject      = true;
            m_DoUpatePath = false;
            return(action);
        }
        if (m_bForce > 0)
        {
            m_bForce--;
        }

        m_PreGrid          = MapPos;
        m_PreAttackStation = m_AttackStation;

        MapGrid  attackstation = MapGrid.GetMG(m_AttackStation);
        PathData CurRoad       = Path.GetPathData(PathAccess.Cur);

        if (m_Attack && RoleParent.m_Skill.CanAttack() && CheckAttackPos()
            // && (!(RoleParent.m_Skill.m_AttackTarget is Role) || RoleParent.m_Skill.CheckCanAttack((RoleParent.m_Skill.m_AttackTarget as Role).CurrentAction))
            && (RoleParent.m_Skill.m_AttackTarget is IggWall || RoleParent.m_Skill.m_AttackTarget is IggFloor || (NdUtil.IsSameMapPos(MapPos, m_AttackStation) &&
                                                                                                                  attackstation.IsAttackStations()) &&//&& attackstation.GetRoleStateInStation(m_SceneID) ==  RoleStationState.HoldStation)
                !(CurRoad != null && (CurRoad.state == RoleState.FALL || CurRoad.state == RoleState.JUMP))))
        {
            if (cdtime > 0)
            {
                if (cdtime > 0.5 && RoleParent.m_Hit)
                {
                    action = new GridActionCmdHit(0.5f, pos, RankDeep, WalkDIR);
                    action.SetTarget(RoleParent);
                    RoleParent.m_Hit = false;
                }
                else
                {
                    action = new GridActionCmdCDStand(cdtime, pos, RankDeep, WalkDIR);
                    action.SetTarget(RoleParent);
                    action.SetSpeed(RoleParent.m_Attr.SpeedPercent);
                }
            }
            m_Reject      = true;
            m_DoUpatePath = false;
            if (action != null)
            {
                return(action);
            }
        }
        else if (m_Attack)
        {
        }

        if (!m_Reject && RoleParent.m_Attr.CanMove && m_Pass)
        {
            PathData NextRoad = Path.GetPathData(PathAccess.Next);
            if (NextRoad != null && CurRoad != null)
            {
                if (MapGrid.GetMG(MapPos).PropStations == StationsProp.ATTACK)
                {
                    m_AttackStation = m_NAttackStation;
                    //获取下一个攻击位,不包含当前节点
                    ErrorInfo Error         = new ErrorInfo();
                    PathData  AttackStation = Path.GetNextAttackPosNoCurInPath(ref Error);
                    if (AttackStation != null)
                    {
                        m_AttackStation  = AttackStation.Road.GridPos;
                        m_NAttackStation = m_AttackStation;
                    }
                }

                RoleState roleState = CurRoad.state;
                Vector3   vStart    = pos;//CurRoad.Road.pos;
                Vector3   vEnd      = Vector3.zero;
                CurrentGS = CurRoad.gs;
                vEnd      = NextRoad.Road.pos;
                if (roleState == RoleState.FALL)
                {
                    vStart = pos;

                    if (Path.CheckRunFirstRoad() == true)
                    {
                        action = new GridActionCmdFall(vStart, vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep);
                    }
                    else
                    {
                        Vector3 mid = Vector3.zero;
                        if (CurRoad.dir == WalkDir.WALKLEFT)
                        {
                            if (CurRoad.Road.Left.Down != null)
                            {
                                NextRoad.Road = CurRoad.Road.Left.Down;//MapGrid.GetMG()
                                mid           = CurRoad.Road.Left.pos;
                            }
                        }
                        else
                        {
                            if (CurRoad.Road.Right.Down != null)
                            {
                                NextRoad.Road = CurRoad.Road.Right.Down;
                                mid           = CurRoad.Road.Right.pos;
                            }
                        }
                        while (NextRoad.Road.Down != null)
                        {
                            NextRoad.Road = NextRoad.Road.Down;
                        }
                        vEnd   = NextRoad.Road.pos;
                        action = new GridActionCmdJumpHoleDown(vStart, mid, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep);
                    }
                }
                else if (roleState == RoleState.JUMP)
                {
                    action = new GridActionCmdJump(vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep, 0.2f, 0.2f,
                                                   0f, null, null, null);
                }
                else if (roleState == RoleState.STAIR)
                {
                    MapStair s1     = MapStair.GetStair(CurRoad.Road.GridPos, CurRoad.Road.GridPos.Layer > NextRoad.Road.GridPos.Layer);
                    Vector3  inpos  = Vector3.zero;
                    Vector3  outpos = Vector3.zero;
                    if (s1 != null)
                    {
                        if (CurRoad.Road.GridPos.Layer > NextRoad.Road.GridPos.Layer)
                        {
                            inpos     = MapGrid.GetMG(s1.GetStairUp()).pos;
                            outpos    = MapGrid.GetMG(s1.GetStairDown()).pos;
                            outpos.y -= 0.5f;
                        }
                        else
                        {
                            outpos   = MapGrid.GetMG(s1.GetStairUp()).pos;
                            inpos    = MapGrid.GetMG(s1.GetStairDown()).pos;
                            inpos.y -= 0.5f;
                        }
                        Building1201 b = s1.GetStairLife();
                        b.ShowUpEffect(CurRoad.deltaTime);
                    }
                    else
                    {
                        Debug.Log("找不到楼梯");
                    }
                    WalkDIR = (CurRoad.Road.GridPos.Unit < NextRoad.Road.GridPos.Unit) ? WalkDir.WALKRIGHT : WalkDir.WALKLEFT;
                    action  = new GridActionCmdStair(vStart, vEnd, 0.5f /*CurRoad.deltaTime*/, WalkDIR, RankDeep, 0.2f, 0.2f, inpos, outpos);
                }
                else if (roleState == RoleState.WALK)
                {
                    float time = 1f / RoleParent.m_Attr.Speed;
                    if (CurRoad.gs == GridSpace.Space_UP)
                    {
                        vStart = CurRoad.Road.Uppos;
                        vEnd   = NextRoad.Road.Uppos;
                        action = new GridActionCmdUnderWalk(vStart, vEnd, time, CurRoad.dir, RankDeep);
                    }
                    else
                    {
                        action = new GridActionCmdWalk(vStart, vEnd, time, CurRoad.dir, RankDeep);
                    }
                }
                else if (roleState == RoleState.FALLDOWN)
                {
                    action        = new GridActionCmdFallDown(Time.deltaTime, RankDeep, vStart);
                    m_Reject      = true;
                    m_DoUpatePath = false;
                    AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_SELFSP), RoleParent);
                    action.SetTarget(RoleParent);
                    return(action);
                }
                else if (roleState == RoleState.JUMPDOWN)
                {
                    vStart = CurRoad.Road.Uppos;
                    action = new GridActionCmdJumpDown(vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep);
                }
                else if (roleState == RoleState.JUMPUP)
                {
                    vEnd   = NextRoad.Road.Uppos;
                    action = new GridActionCmdJumpUp(vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep);
                }
                else if (roleState == RoleState.REVERSEJUMP)
                {
                    vStart = CurRoad.Road.Uppos;
                    vEnd   = NextRoad.Road.Uppos;
                    action = new GridActionCmdReverseJump(vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep, 0.2f, 0.2f,
                                                          0f, null, null, null);
                }
                else if (roleState == RoleState.HITFLY)
                {
                }

                if (action != null)
                {
                    MapPos  = NextRoad.Road.GridPos;
                    m_NGrid = MapPos;
                    WalkDIR = CurRoad.dir;
                    action.SetTarget(RoleParent);
                    action.SetSpeed(RoleParent.m_Attr.SpeedPercent);
                }
                //运行到下一个路径节点
                Path.RunNextPath();
                m_IndexAdd = true;
            }
            else if (CurrentGS == GridSpace.Space_UP)
            {
                action = new GridActionCmdJumpDown(MapGrid.GetMG(MapPos).Uppos, MapGrid.GetMG(MapPos).pos, 1f, m_AttackDir, RankDeep);
                action.SetTarget(RoleParent);
                CurrentGS = GridSpace.Space_DOWN;
            }
            else
            {
                //if (!( NdUtil.IsSameMapPos(MapPos,m_AttackStation) && attackstation.GetRoleStateInStation(m_SceneID) ==  RoleStationState.HoldStation))
                AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_SELFSP), RoleParent);
            }
        }
        if (action == null)
        {
            action = new GridActionCmdStand();
            action.SetData(pos, pos, RoleState.STAND, Time.deltaTime, -1, WalkDIR, RankDeep);
            action.SetTarget(RoleParent);
        }
        m_Reject      = true;
        m_DoUpatePath = false;
        return(action);
    }
Beispiel #4
0
    public bool CheackIdlePath()
    {
        /*if (!CheckHaveIdleAttackPosInPath(m_SceneID))
         * {
         *      MapGrid attackstation =MapGrid.GetMG(m_AttackStation);
         *      if (attackstation != null)
         *      {
         #if UNITY_EDITOR_LOG
         *              FileLog.write(m_SceneID,"CheackIdlePath   m_AttackStation: " + m_AttackStation + "MapPos:" + MapPos + "attackstation.GetRoleStateInStation(m_SceneID):" + attackstation.GetRoleStateInStation(m_SceneID));
         #endif
         *              if ( (NdUtil.IsSameMapPos(MapPos,m_AttackStation) && attackstation.IsAttackStations()))
         *              {
         *                      FirstCheckAttack();
         *                      if (!m_Attack)
         *                              m_Pass = false;
         *                      return;
         *              }
         *              else
         *              {
         *                      MapGrid g = GetFreeAttackStation();
         *                      if (g != null)
         *                      {
         *                              ClearPath();
         *                              Path.PathAI(m_SceneID,MapGrid.GetMG(MapPos),g,m_parent.m_Attr as RoleAttribute,CurrentGS,WalkDIR);
         *                      }
         *                      else
         *                      {
         #if UNITY_EDITOR_LOG
         *                              //Debug.Log("没有空闲攻击位 " + MapPos );
         #endif
         *                      }
         *              }
         *      }
         *
         * }
         * else
         *      m_Pass = true;
         * //判断首个节点是否为楼梯
         * 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.SearchPath.Count == 0 || Path.SearchPath.Count == 1 || (Path.SearchPath.Count == 2 && !Path.SearchPath[0].Road.IsAttackStations() && !Path.SearchPath[1].Road.IsAttackStations()))
        {
            MapGrid attackstation = MapGrid.GetMG(m_AttackStation);
            if (!(NdUtil.IsSameMapPos(MapPos, m_AttackStation) && attackstation.IsAttackStations()))
            {
                MapGrid g = GetFreeAttackStation();
                if (g != null)
                {
                    ClearPath();
                    Path.PathAI(m_SceneID, MapGrid.GetMG(MapPos), g, m_parent.m_Attr as RoleAttribute, CurrentGS, WalkDIR);
                    PathInit();
                    return(true);
                }
                else
                {
#if UNITY_EDITOR_LOG
                    //Debug.Log("没有空闲攻击位 " + MapPos );
#endif
                }
            }
            else
            {
                List <int> samelist   = new List <int>();
                List <int> unsamelist = new List <int>();
                attackstation.GetCampRoleList(m_parent.m_Core.m_Camp, ref samelist, ref unsamelist);
                if (unsamelist.Count > 0)
                {
#if UNITY_EDITOR_LOG
                    FileLog.write(m_SceneID, "CheackIdlePath- CheckAttackPos" + Path.Indext + "," + m_ForceGrid + "," + m_NGrid + "," + MapPos + "," + m_AttackStation + "," + m_NAttackStation
                                  + "," + m_Attack + "," + RoleParent.m_Skill.CanAttack() + "," + Time.realtimeSinceStartup);
#endif
                    m_FindAttackpos = true;

                    (m_parent as Role).ChangeTarget(ChangeTargetReason.ClearTarget, null);
                    MapGrid g = GetCanAttackStation();
                    if (g != null)
                    {
                        ClearPath();
                        Path.PathAI(m_SceneID, MapGrid.GetMG(MapPos), g, m_parent.m_Attr as RoleAttribute, CurrentGS, WalkDIR);
                        PathInit();
                        return(true);
                    }
                    else
                    {
#if UNITY_EDITOR_LOG
                        //Debug.Log("没有空闲攻击位 " + MapPos );
#endif
                    }
                }
            }
        }
        return(false);
    }
Beispiel #5
0
    public GridActionCmd GetAttackAction()
    {
        RoleSkill     roleskill = RoleParent.m_Skill as RoleSkill;
        GridActionCmd action    = null;

#if UNITY_EDITOR_LOG
        FileLog.write(m_SceneID, "GetAttackAction:  pre  " + m_PreAttackStation + "," + m_AttackStation + RoleParent.m_thisT.localPosition);
#endif
        if (!NdUtil.IsSameMapPos(m_PreAttackStation, m_NAttackStation))
        {
            m_AttackStation  = m_PreAttackStation;
            m_NAttackStation = m_AttackStation;

            MapCheckStations.RoleStation(m_SceneID,
                                         MapGrid.GetMG(m_AttackStation),
                                         new StationsInfo(RoleParent.m_Attr as RoleAttribute, RankDeep, RoleParent.m_Core.m_Camp, DIR.LEFT, GridSpace.Space_DOWN)
                                         );
#if UNITY_EDITOR_LOG
            FileLog.write(m_SceneID, "GetAttackAction:" + m_AttackStation);
#endif
        }

        if (CurrentGS == GridSpace.Space_UP)
        {
            action = new GridActionCmdJumpDown(MapGrid.GetMG(MapPos).Uppos, MapGrid.GetMG(MapPos).pos, 1f, m_AttackDir, RankDeep);
            action.SetTarget(RoleParent);
            CurrentGS = GridSpace.Space_DOWN;
        }
        else
        {
            if (RoleParent.m_Skill.m_AttackTarget == null)
            {
                Debug.Log(RoleParent.PropAttackSkillInfo.m_type);
            }
            //if (RoleParent.m_Skill.CheckDoAttackTarget(RoleParent.m_Skill.m_AttackTarget.SceneID))
            {
                action = RoleSkill.GetAttackSkillAction(RoleParent.PropAttackSkillInfo.m_type,
                                                        m_NextAttackSceneID, m_AttackDir, RankDeep, RoleParent.m_Attr.ModelType, m_SceneID);
                RoleParent.m_Skill.ReSetCDTime();
                if (action == null)
                {
                    Debug.Log(RoleParent.PropAttackSkillInfo.m_type + "," + m_SceneID);
                }
                else
                {
                    (action as GridActionCmdAttack).StartWithTarget(RoleParent, RoleParent.StartAttack);
                }
                WalkDIR = m_AttackDir;
            }
            if (action != null)
            {
                if (RoleParent.m_Skill.m_AttackTarget == RoleParent.Target)
                {
                    RoleParent.m_TargetDuration = RoleParent.m_changetargettime;
                }
                action.SetSpeed(RoleParent.m_Attr.AttackSpeed);
            }
            else
            {
                //bool check = RoleParent.m_Skill.CheckDoAttackTarget(RoleParent.m_Skill.m_AttackTarget.SceneID);
            }
        }

        m_Attack      = false;
        m_Reject      = true;
        m_DoUpatePath = false;
        return(action);
    }
Beispiel #6
0
    public bool CheckAttackCondition()
    {
        PathData PrevRoad      = Path.GetPathData(PathAccess.Prev, true);
        MapGrid  attackstation = MapGrid.GetMG(m_AttackStation);

        if (m_Attack && RoleParent.m_Skill.CanAttack() &&
            (!(RoleParent.m_Skill.m_AttackTarget is Role) || RoleSkill.CheckCanAttack((RoleParent.m_Skill.m_AttackTarget as Role).CurrentAction)) &&
            (RoleParent.m_Skill.m_AttackTarget is IggWall || RoleParent.m_Skill.m_AttackTarget is IggFloor || (NdUtil.IsSameMapPos(m_PreGrid, m_AttackStation) &&
                                                                                                               attackstation.IsAttackStations() /* && attackstation.GetRoleStateInStation(m_SceneID) ==  RoleStationState.HoldStation*/) &&
             !(PrevRoad != null && (PrevRoad.state == RoleState.FALL || PrevRoad.state == RoleState.JUMP))))
        {
            return(true);
        }
        return(false);
    }
Beispiel #7
0
    //取下一个动作
    public GridActionCmd GetNextAction()
    {
        Vector3 pos    = RoleParent.m_thisT.localPosition;
        float   cdtime = RoleParent.CDTime;
        //int bodyradius = RoleParent.m_Attr.Radius;
        RoleSkill     roleskill = RoleParent.m_Skill as RoleSkill;
        GridActionCmd action    = null;

        m_IndexAdd = false;
        if (RoleParent.isDead)
        {
            action = new GridActionCmdDie(pos, 3 * 60 * 60f, WalkDIR, RankDeep);
            action.SetTarget(RoleParent);
            Reject = false;
            return(action);
        }


        if (RoleParent == null || RoleParent.m_Attr == null)
        {
            action = new GridActionCmdStand();
            action.SetData(pos, pos, RoleState.STAND, Time.deltaTime, -1, WalkDIR, RankDeep);
            action.SetTarget(RoleParent);
            return(action);
        }

        if (m_bForce == 0)
        {
            action = new GridActionCmdSpecialJump(0.5f, MapGrid.GetMG(MapPos).pos, MapGrid.GetMG(m_ForceGrid).pos, m_ForceDir, RankDeep);
            action.SetTarget(RoleParent);
            m_bForce = -1;
            SetUpdataPath(new AIEventData(AIEvent.EVENT_MAP));
            m_NGrid = m_ForceGrid;
            if (MapGrid.GetMG(MapPos).PropStations == StationsProp.ATTACK)
            {
                m_AttackStation  = MapPos;
                m_NAttackStation = MapPos;
            }
            MapPos        = m_NGrid;
            WalkDIR       = m_ForceDir;
            Reject        = true;
            m_DoUpatePath = false;
            return(action);
        }
        if (m_bForce > 0)
        {
            m_bForce--;
        }

        m_PreGrid          = MapPos;
        m_PreAttackStation = m_AttackStation;

        MapGrid  attackstation = MapGrid.GetMG(m_AttackStation);
        PathData CurRoad       = Path.GetPathData(PathAccess.Cur);

        if (m_Attack && RoleParent.m_Skill.CanAttack() && CheckAttackPos()
            // && (!(RoleParent.m_Skill.m_AttackTarget is Role) || RoleParent.m_Skill.CheckCanAttack((RoleParent.m_Skill.m_AttackTarget as Role).CurrentAction))
            && (RoleParent.m_Skill.m_AttackTarget is IggWall || RoleParent.m_Skill.m_AttackTarget is IggFloor || (NdUtil.IsSameMapPos(MapPos, m_AttackStation) &&
                                                                                                                  attackstation.IsAttackStations()) &&//&& attackstation.GetRoleStateInStation(m_SceneID) ==  RoleStationState.HoldStation)
                !(CurRoad != null && (CurRoad.state == RoleState.FALL || CurRoad.state == RoleState.JUMP))))
        {
            if (cdtime > 0)
            {
                if (cdtime > 0.5 && RoleParent.m_Hit)
                {
                    action = new GridActionCmdHit(0.5f, pos, RankDeep, WalkDIR);
                    action.SetTarget(RoleParent);
                    RoleParent.m_Hit = false;
                }
                else
                {
                    action = new GridActionCmdCDStand(cdtime, pos, RankDeep, WalkDIR);
                    action.SetTarget(RoleParent);
                    action.SetSpeed(RoleParent.m_Attr.SpeedPercent);
                }
            }
            Reject        = true;
            m_DoUpatePath = false;
            if (action != null)
            {
                return(action);
            }
        }
        else if (m_Attack)
        {
        }

        if (!m_Reject && RoleParent.m_Attr.CanMove && m_Pass)
        {
            PathData NextRoad = Path.GetPathData(PathAccess.Next);
            if (NextRoad != null && CurRoad != null)
            {
                if (MapGrid.GetMG(MapPos).PropStations == StationsProp.ATTACK)
                {
                    m_AttackStation = m_NAttackStation;
                    //获取下一个攻击位,不包含当前节点
                    ErrorInfo Error         = new ErrorInfo();
                    PathData  AttackStation = Path.GetNextAttackPosNoCurInPath(ref Error);
                    if (AttackStation != null)
                    {
                        m_AttackStation  = AttackStation.Road.GridPos;
                        m_NAttackStation = m_AttackStation;
                    }
                }

                RoleState roleState = CurRoad.state;
                Vector3   vStart    = pos;//CurRoad.Road.pos;
                Vector3   vEnd      = Vector3.zero;
                CurrentGS = CurRoad.gs;
                vEnd      = NextRoad.Road.pos;
                if (roleState == RoleState.FALL)
                {
                    vStart = pos;

                    if (Path.CheckRunFirstRoad() == true)
                    {
                        action = new GridActionCmdFall(vStart, vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep);
                    }
                    else
                    {
                        Vector3 mid = Vector3.zero;
                        if (CurRoad.dir == WalkDir.WALKLEFT)
                        {
                            if (CurRoad.Road.Left.Down != null)
                            {
                                NextRoad.Road = CurRoad.Road.Left.Down;//MapGrid.GetMG()
                                mid           = CurRoad.Road.Left.pos;
                            }
                        }
                        else
                        {
                            if (CurRoad.Road.Right.Down != null)
                            {
                                NextRoad.Road = CurRoad.Road.Right.Down;
                                mid           = CurRoad.Road.Right.pos;
                            }
                        }
                        while (NextRoad.Road.Down != null)
                        {
                            NextRoad.Road = NextRoad.Road.Down;
                        }
                        vEnd   = NextRoad.Road.pos;
                        action = new GridActionCmdJumpHoleDown(vStart, mid, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep);
                    }
                }
                else if (roleState == RoleState.JUMP)
                {
                    /*if ( NextRoad.Road.Type == GridType.GRID_WALL && RoleParent.m_Core.m_Camp == LifeMCamp.ATTACK)
                     * {
                     *  Life w = NextRoad.Road.GetWall();
                     *  int width = Mathf.Abs(NextRoad.Road.GridPos.Unit - CurRoad.Road.GridPos.Unit);
                     *  float t = CurRoad.deltaTime * (width - bodyradius) / (float)width;
                     *  int flag = NextRoad.Road.GridPos.Unit > CurRoad.Road.GridPos.Unit ? -1 : 1;
                     *  MapGrid m = MapGrid.GetMG(new Int2(NextRoad.Road.GridPos.Unit+ flag * bodyradius,NextRoad.Road.GridPos.Layer));
                     *  action = new GridActionCmdJump(vStart,vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep,0.2f,0.2f,t,RoleParent.JumpAttack,w,m);
                     * }
                     * else*/
                    action = new GridActionCmdJump(vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep, 0.2f, 0.2f,
                                                   0f, null, null, null);
                }
                else if (roleState == RoleState.STAIR)
                {
                    MapStair s1      = MapStair.GetStair(CurRoad.Road.GridPos, CurRoad.Road.GridPos.Layer > NextRoad.Road.GridPos.Layer);
                    Vector3  inpos   = Vector3.zero;
                    Vector3  outpos  = Vector3.zero;
                    bool     bOccupy = false;
                    if (NextRoad.Road.Left != null && NextRoad.Road.Left.Type != GridType.GRID_HOLE)
                    {
                        List <int> rolelist = new List <int>();
                        MapGrid    g        = NextRoad.Road.Left;
                        g.GetRoleList(ref rolelist);
                        if (rolelist.Count > 0)
                        {
                            for (int i = 0; i < rolelist.Count; i++)
                            {
                                Role l = CM.GetAllLifeM(rolelist[i], LifeMType.SOLDIER | LifeMType.SUMMONPET) as Role;
                                if (l.m_Core.m_Camp != m_parent.m_Core.m_Camp)
                                {
                                    bOccupy = true;
                                    break;
                                }
                            }
                        }
                        if (!bOccupy)
                        {
                            NextRoad.Road = NextRoad.Road.Left;
                        }
                    }
                    if (bOccupy && NextRoad.Road.Right != null && NextRoad.Road.Right.Type != GridType.GRID_HOLE)
                    {
                        bOccupy = false;
                        List <int> rolelist = new List <int>();
                        MapGrid    g        = NextRoad.Road.Right;
                        g.GetRoleList(ref rolelist);
                        if (rolelist.Count > 0)
                        {
                            for (int i = 0; i < rolelist.Count; i++)
                            {
                                Role l = CM.GetAllLifeM(rolelist[i], LifeMType.SOLDIER | LifeMType.SUMMONPET) as Role;
                                if (l.m_Core.m_Camp != m_parent.m_Core.m_Camp)
                                {
                                    bOccupy = true;
                                    break;
                                }
                            }
                        }
                        if (!bOccupy)
                        {
                            NextRoad.Road = NextRoad.Road.Right;
                        }
                    }
                    if (bOccupy && NextRoad.Road.Left.Type != GridType.GRID_HOLE)
                    {
                        NextRoad.Road = NextRoad.Road.Left;
                    }

                    vEnd = NextRoad.Road.pos;

                    if (s1 != null)
                    {
                        if (CurRoad.Road.GridPos.Layer > NextRoad.Road.GridPos.Layer)
                        {
                            inpos     = CurRoad.Road.pos;  //MapGrid.GetMG(s1.GetStairUp()).pos;
                            outpos    = NextRoad.Road.pos; //MapGrid.GetMG(s1.GetStairDown()).pos;
                            outpos.y -= 0.5f;
                        }
                        else
                        {
                            outpos   = NextRoad.Road.pos; //MapGrid.GetMG(s1.GetStairUp()).pos;
                            inpos    = CurRoad.Road.pos;  //MapGrid.GetMG(s1.GetStairDown()).pos;
                            inpos.y -= 0.5f;
                        }
                        Building1201 b = s1.GetStairLife();
                        b.ShowUpEffect(CurRoad.deltaTime);
                        SetPet1002StairState(true);
                    }
                    else
                    {
                        Debug.Log("找不到楼梯");
                    }
                    WalkDIR = (CurRoad.Road.GridPos.Unit < NextRoad.Road.GridPos.Unit) ? WalkDir.WALKRIGHT : WalkDir.WALKLEFT;
                    action  = new GridActionCmdStair(vStart, vEnd, 0.5f /*CurRoad.deltaTime*/, WalkDIR, RankDeep, 0.2f, 0.2f, inpos, outpos);
                }
                else if (roleState == RoleState.WALK)
                {
                    float time = 1f / RoleParent.m_Attr.Speed;
                    if (CurRoad.gs == GridSpace.Space_UP)
                    {
                        vStart = CurRoad.Road.Uppos;
                        vEnd   = NextRoad.Road.Uppos;
                        action = new GridActionCmdUnderWalk(vStart, vEnd, time, CurRoad.dir, RankDeep);
                    }
                    else
                    {
                        action = new GridActionCmdWalk(vStart, vEnd, time, CurRoad.dir, RankDeep);
                    }
                    SetPet1002WalkState();
                }
                else if (roleState == RoleState.FALLDOWN)
                {
                    action        = new GridActionCmdFallDown(Time.deltaTime, RankDeep, vStart);
                    Reject        = true;
                    m_DoUpatePath = false;
                    AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_SELFSP), RoleParent);
                    action.SetTarget(RoleParent);
                    return(action);
                }
                else if (roleState == RoleState.JUMPDOWN)
                {
                    vStart = CurRoad.Road.Uppos;
                    action = new GridActionCmdJumpDown(vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep);
                }
                else if (roleState == RoleState.JUMPUP)
                {
                    vEnd   = NextRoad.Road.Uppos;
                    action = new GridActionCmdJumpUp(vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep);
                }
                else if (roleState == RoleState.REVERSEJUMP)
                {
                    vStart = CurRoad.Road.Uppos;
                    vEnd   = NextRoad.Road.Uppos;
                    action = new GridActionCmdReverseJump(vStart, vEnd, CurRoad.deltaTime, CurRoad.dir, RankDeep, 0.2f, 0.2f,
                                                          0f, null, null, null);
                }
                else if (roleState == RoleState.HITFLY)
                {
                }

                if (action != null)
                {
                    MapPos  = NextRoad.Road.GridPos;
                    m_NGrid = MapPos;
                    WalkDIR = CurRoad.dir;
                    action.SetTarget(RoleParent);
                    action.SetSpeed(RoleParent.m_Attr.SpeedPercent);
                }
                //运行到下一个路径节点
                Path.RunNextPath();
                m_IndexAdd = true;
            }
            else if (CurrentGS == GridSpace.Space_UP)
            {
                action = new GridActionCmdJumpDown(MapGrid.GetMG(MapPos).Uppos, MapGrid.GetMG(MapPos).pos, 1f, m_AttackDir, RankDeep);
                action.SetTarget(RoleParent);
                CurrentGS = GridSpace.Space_DOWN;
            }
            else
            {
                //if (!( NdUtil.IsSameMapPos(MapPos,m_AttackStation) && attackstation.GetRoleStateInStation(m_SceneID) ==  RoleStationState.HoldStation))
                AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_SELFSP), RoleParent);
            }
        }
        if (action == null)
        {
            action = new GridActionCmdStand();
            action.SetData(pos, pos, RoleState.STAND, Time.deltaTime, -1, WalkDIR, RankDeep);
            action.SetTarget(RoleParent);
        }
        Reject        = true;
        m_DoUpatePath = false;
        return(action);
    }