예제 #1
0
    //取下一个动作
    public GridActionCmd GetNextAction()
    {
        Vector3       pos    = PetParent.m_thisT.localPosition;
        GridActionCmd action = null;

        if (Path.CheckRunFinishRoad())
        {
            return(null);
        }

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

        m_PreGrid          = MapPos;
        m_PreAttackStation = m_AttackStation;

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


        if (PetParent.m_Attr.CanMove)
        {
            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;
                    }
                }

                RoleState roleState = CurRoad.state;
                Vector3   vStart    = 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;
                        }
                    }
                    else
                    {
                        Debug.Log("找不到楼梯");
                    }
                    WalkDIR = (CurRoad.Road.GridPos.Unit < NextRoad.Road.GridPos.Unit)? WalkDir.WALKRIGHT:WalkDir.WALKLEFT;
                    action  = new GridActionCmdStair(vStart, vEnd, CurRoad.deltaTime, WalkDIR, RankDeep, 0.2f, 0.2f, inpos, outpos);
                }
                else if (roleState == RoleState.WALK)
                {
                    float time = 1f / (PetParent.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;
                    AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_SELFSP), PetParent);
                    action.SetTarget(PetParent);
                    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(PetParent);
                    action.SetSpeed(PetParent.m_Attr.SpeedPercent);
                }
                //运行到下一个路径节点
                Path.RunNextPath();
            }
            else if (CurrentGS == GridSpace.Space_UP)
            {
                action = new GridActionCmdJumpDown(MapGrid.GetMG(MapPos).Uppos, MapGrid.GetMG(MapPos).pos, 1f, m_AttackDir, RankDeep);
                action.SetTarget(PetParent);
                CurrentGS = GridSpace.Space_DOWN;
            }
        }
        if (action == null)
        {
            action = new GridActionCmdStand();
            action.SetData(pos, pos, RoleState.STAND, Time.deltaTime, -1, WalkDIR, RankDeep);
            action.SetTarget(PetParent);
        }
        m_Reject = true;

        return(action);
    }
예제 #2
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);
    }
예제 #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);
            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);
    }