Exemple #1
0
    /// <summary>
    /// 创建建筑物体
    /// </summary>
    private static void ProduceStairBulid(BuildInfo Info)
    {
        if (Info == null)
        {
            return;
        }
        Int2      Pos = new Int2(Info.m_cx, Info.m_cy);
        Transform t   = GetLifeMBornNode(true);

        if (t == null)
        {
            return;
        }
        Vector3 worldPos = Vector3.zero;
        MapGrid mg       = MapGrid.GetMG(Pos);

        if (mg != null)
        {
            worldPos.x = mg.WorldPos.x; //-MapGrid.m_width/2 ;
            worldPos.y = mg.WorldPos.y;
        }
        else
        {
            return;
        }

        Building1201 stair = LifeFactory.CreateBuilding(Info, 0, t, worldPos, LifeEnvironment.Combat) as Building1201;

        if (stair != null)
        {
            stair.SetMapGrid(Info.m_cx + 2, Info.m_cy);
        }
    }
    //取下一个动作
    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);
    }
Exemple #3
0
    private static Building GetBuildingLife(BuildInfo Info, LifeProperty SkinProperty, LifeEnvironment Environment)
    {
        if (Info == null || SkinProperty == null)
        {
            return(null);
        }
        Building life = null;

        switch (Info.BuildType)
        {
        case 1201:
            life = new Building1201();
            break;

        case 1300:
            life = new Building1300();
            break;

        case 1601:
            life = new Building1601();
            break;

        case 1602:
            life = new Building1602();
            break;

        case 1603:
            life = new Building1603();
            break;

        case 1604:
            life = new Building1604();
            break;

        case 1605:
            life = new Building1605();
            break;

        case 1606:
            life = new Building1606();
            break;

        case 1607:
            life = new Building1607();
            break;

        case 1608:
            life = new Building1608();
            break;

        case 1609:
            life = new Building1609();
            break;

        case 1610:
            life = new Building1610();
            break;

        case 1611:
            life = new Building1611();
            break;

        case 1612:
            life = new Building1612();
            break;

        case 1613:
            life = new Building1613();
            break;

        case 1619:
            life = new Building1619();
            break;

        case 9999:
            life = new Building9999();
            break;

        case 9998:
            life = new Building9998();
            break;

        case 9997:
            life = new Building9997();
            break;

        default:
            break;
        }
        if (life != null)
        {
            life.SetBuildLife(Info, SkinProperty, Environment);
            life.InitBuildModel();
        }
        else
        {
            Debug.Log("create building fail:" + Info.BuildType);
        }
        return(life);
    }
Exemple #4
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);
    }
Exemple #5
0
 /// <summary>
 /// 加入楼梯对象
 /// </summary>
 public void JoinStairLife(Building1201 stair)
 {
     m_stair = stair;
 }