public void Teleport(MapGrid g)
 {
     MapCheckStations.RoleStation(m_SceneID,
                                  g,
                                  new StationsInfo(RoleParent.m_Attr as RoleAttribute, RankDeep, RoleParent.m_Core.m_Camp, DIR.LEFT, GridSpace.Space_DOWN));
     MapPos           = g.GridPos;
     m_NGrid          = g.GridPos;
     m_AttackStation  = g.GridPos;
     m_NAttackStation = g.GridPos;
 }
    public void SetBorn(Int2 BornPos, int deep)
    {
        MapPos           = BornPos;
        m_AttackStation  = MapPos;
        m_NAttackStation = MapPos;
        m_NGrid          = BornPos;
        RankDeep         = deep;
        //
        MapGrid m = MapGrid.GetMG(MapPos);

        if (m != null)
        {
            if (MapM.AskForMapGridDeep(m_SceneID, m, deep, RoleParent.m_Core.m_Camp, DIR.LEFT, SEARCHAGT.SAGTY_POLL, ref BornPos, ref deep))
            {
                m        = MapGrid.GetMG(BornPos);
                RankDeep = deep;
                MapCheckStations.RoleStation(m_SceneID, m, new StationsInfo(RoleParent.m_Attr as RoleAttribute,
                                                                            RankDeep,
                                                                            RoleParent.m_Core.m_Camp,
                                                                            DIR.LEFT,
                                                                            GridSpace.Space_DOWN));
            }
        }
    }
    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);
    }
    //格子注册,用来预测用
    public void RegisterNextAction(bool IsMove = true)
    {
        //如果需要强制跳跃,就不做预测
        if (m_bForce > -1 || !m_Reject)
        {
            return;
        }

        RoleState CurState = RoleState.WALK;
        PathData  PrevRoad = Path.GetPathData(PathAccess.Prev);
        PathData  CurRoad  = Path.GetPathData(PathAccess.Cur);
        PathData  NextRoad = Path.GetPathData(PathAccess.Next);

        if (PrevRoad != null)
        {
            CurState = PrevRoad.state;
        }

        m_DoUpatePath = true;
        if (CurState == RoleState.STAIR || CurState == RoleState.JUMP || CurState == RoleState.FALL)
        {
            if (CurState == RoleState.JUMP && CurRoad.state == RoleState.FALL)
            {
                m_Reject = false;
                return;
            }

            AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_SELFSP), RoleParent);
        }

        //获取下一个Action
        if (CurRoad == null)
        {
            return;
        }
        if (CurRoad.state != RoleState.FALLDOWN && IsMove && NextRoad != null)
        {
            m_NGrid = NextRoad.Road.GridPos;
            WalkDIR = CurRoad.dir;
        }
#if UNITY_EDITOR_LOG
        FileLog.write(m_SceneID, "DORegisterNextAction" + Path.Indext + "," + m_ForceGrid + "," + m_NGrid + "," + MapPos + "," + m_AttackStation + "," + m_NAttackStation
                      + "," + m_Attack + "," + RoleParent.m_Skill.CanAttack() + "," + Time.realtimeSinceStartup);
#endif
        MapStations cur  = CurRoad.Road;
        MapStations next = CurRoad.Road;
        if (NextRoad != null)
        {
            next = NextRoad.Road;
        }
        RoleState NextState = CurRoad.state;
        //
        if (MapPos != PreGrid)
        {
            (m_parent as Role).m_ajustcount += (m_parent as Role).m_ajustduration;
        }
        if (MapPos == m_AttackStation)
        {
            cur = MapGrid.GetMG(m_AttackStation) as MapStations;
            DIR dir = WalkDIR == WalkDir.WALKLEFT ? DIR.LEFT : DIR.RIGHT;

            MapCheckStations.RoleStation(m_SceneID, cur, new StationsInfo(RoleParent.m_Attr as RoleAttribute, RankDeep, RoleParent.m_Core.m_Camp, dir, GridSpace.Space_DOWN));
            bool      isEnd         = true;
            ErrorInfo Error         = new ErrorInfo();
            PathData  AttackStation = Path.GetNextAttackPosNoCurInPath(ref Error);
            if (AttackStation != null)
            {
                isEnd = false;
            }
            else if (Error.Err == ErrReason.NoAttackPos)
            {
                isEnd = true;
            }
            else if (Error.Err == ErrReason.RePathPoint)
            {
                isEnd = false;
                if (Error.state == RoleState.STAIR)
                {
                    if (m_Pass)
                    {
                        bool IsUP = (Error.dir == DIR.DOWN) ? true : false;
                        next = MapStair.GetStair(Error.GridPos, IsUP);
#if UNITY_EDITOR_LOG
                        if (next == null)
                        {
                            Debug.LogError("楼梯为空" + Error.GridPos + "," + Error.dir);
                        }
                        FileLog.write(m_SceneID, "DORegisterNextActionSTAIRin" + Path.Indext + "," + MapPos + "," + m_NGrid + "," + RankDeep + "," + next.GetStationsPos() + "," + cur.GetStationsPos() + "," + Time.realtimeSinceStartup);
#endif
                        MapCheckStations.RoleStation(m_SceneID, next, new StationsInfo(RoleParent.m_Attr as RoleAttribute, RankDeep, RoleParent.m_Core.m_Camp, Error.dir, GridSpace.Space_DOWN));
                    }
                }
            }
            if (isEnd)
            {
                ClearPath();
            }
        }
        else
        {
            DIR dir = WalkDIR == WalkDir.WALKLEFT ? DIR.LEFT : DIR.RIGHT;
            MapCheckStations.RoleStation(m_SceneID, cur, new StationsInfo(RoleParent.m_Attr as RoleAttribute, RankDeep, RoleParent.m_Core.m_Camp, dir, GridSpace.Space_DOWN));
        }
        m_Reject = false;
    }