Esempio n. 1
0
    /// <summary>
    /// 释放技能主逻辑
    /// </summary>
    protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex)
    {
        m_RoleList.Clear();
        bool IsRelease = false;

        if (RoleList.Count > 0)
        {
            IsRelease = true;
            foreach (Life w in RoleList)
            {
                m_RoleList.Add(w);
                GridActionCmd action = null;
                if (w is Role)
                {
                    action = (w as Role).CurrentAction;
                }
                SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo);
                w.ApplyDamage(Info, m_thisT);
            }
            m_fAttackTrigger = Time.time;
            m_bBomb          = true;
            SoundPlay.Play("littleboom", false, false);
            SetAnimator(Build_AnimatorState.Trigger30000);
            m_goEffect1003031.SetActive(true);
        }
        return(IsRelease);
    }
Esempio n. 2
0
    /// <summary>
    /// 释放技能主逻辑
    /// </summary>
    protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex)
    {
        bool IsRelease = false;

        if (RoleList.Count > 0)
        {
            IsRelease = true;
            SetAnimator(Build_AnimatorState.Trigger30000);
            //foreach(Life w in RoleList)
            {
                Life    w       = RoleList[0];
                Vector3 posSrc  = Pao.transform.position;
                Vector3 posRole = new Vector3(w.GetPos().x, w.GetPos().y, w.GetPos().z);
                float   fgreed  = NdUtil.V2toAngle(posSrc, posRole, Vector3.right);
                m_vDirGreed = new Vector3(fgreed, 90f, 0);
                bool          InterruptSkill = false;
                GridActionCmd action         = null;
                if (w is Role)
                {
                    action = (w as Role).CurrentAction;
                }
                SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo);
                w.ApplyDamage(Info, m_thisT);
            }
            m_bAttack     = true;
            m_fAttackTime = Time.time;
            ActiveEffect1915011(true);
        }
        return(IsRelease);
    }
Esempio n. 3
0
    /// <summary>
    /// 释放技能主逻辑
    /// </summary>
    protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex)
    {
        bool IsRelease = false;

        if (RoleList.Count > 0)
        {
            IsRelease = true;
            {
                Life    w       = RoleList[0];
                Vector3 posSrc  = m_goPao.transform.position;
                Vector3 posRole = new Vector3(w.GetPos().x, w.GetPos().y, w.GetPos().z);
                float   fgreed  = NdUtil.V2toAngle(posSrc, posRole, Vector3.right);
                if (fgreed < 0f || fgreed > 270)
                {
                    fgreed = 0f;
                }
                else if (fgreed > 180f)
                {
                    fgreed = 180f;
                }
                m_vDirGreed = new Vector3(0, -fgreed, 0);
                bool          InterruptSkill = false;
                GridActionCmd action         = null;
                if (w is Role)
                {
                    action = (w as Role).CurrentAction;
                }
                SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo);
                w.ApplyDamage(Info, m_thisT);
            }
        }
        return(IsRelease);
    }
Esempio n. 4
0
 public virtual bool CheckCanAttack(GridActionCmd action)
 {
     if (action is GridActionCmdStair || action is GridActionCmdJump || action is GridActionCmdSpecialJump || action is GridActionCmdFall || action is GridActionCmdSendToPos)
     {
         return(false);
     }
     return(true);
 }
Esempio n. 5
0
 public void SendToGrid(Vector3 start, Vector3 startTo, Vector3 endFr, Vector3 end, float duration, MapGrid m)
 {
     if (null != m_CurrentAction)
     {
         m_CurrentAction.SetDone();
     }
     m_CurrentAction = new GridActionCmdSendToPos(this, m_thisT.localPosition, startTo, endFr, end, duration, m_dir, 1, m);
     //MapM.EmptyRoleStations(m_SceneID);
 }
Esempio n. 6
0
 //如果是全图的技能,不过滤
 static public bool CheckCanAttack(GridActionCmd action, bool ignoredistance = false)
 {
     if (ignoredistance)
     {
         return(true);
     }
     if (action is GridActionCmdStair || action is GridActionCmdJump || action is GridActionCmdSpecialJump || action is GridActionCmdFall || action is GridActionCmdSendToPos)
     {
         return(false);
     }
     return(true);
 }
Esempio n. 7
0
    /// <summary>
    /// 释放技能主逻辑
    /// </summary>
    protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex)
    {
        bool IsRelease = false;

        if (RoleList.Count > 0)
        {
            m_bCDOver = false;

            m_fAttackTimer = Time.time;

            IsRelease = true;
            bool ispress = true;            //是否可以压扁

            /*{
             *      foreach(Life life in RoleList)
             *      {
             *              if (life.m_Attr.AntiPress > 100)
             *              {
             *                      ispress = false;
             *                      GridActionCmd action = null;
             *                      if (life is Role)
             *                              action = (life as Role).CurrentAction;
             *                      SkillReleaseInfo Info = m_Skill.SkillRelease(this,life,action,m_Skill.PropSkillInfo);
             *                      //life.ApplyDamage(Info, transform);
             *                      SetAnimator (Build_AnimatorState.Trigger30100);
             *                      m_bAttackedToDie=true;
             *              }
             *      }
             * }*/
            if (ispress)
            {
                foreach (Life lifepress in RoleList)
                {
                    GridActionCmd action = null;
                    if (lifepress is Role)
                    {
                        action = (lifepress as Role).CurrentAction;
                    }
                    SkillReleaseInfo Info = m_Skill.SkillRelease(this, lifepress, action, m_Skill.PropSkillInfo);
                    lifepress.ApplyDamage(Info, m_thisT);
                }
                SetAnimator(Build_AnimatorState.Trigger30000);
                m_bAttacke = true;

                SoundPlay.Play("Trap/trap_flattening", false, false);
                m_goEffect1914021.SetActive(true);
            }
        }
        return(IsRelease);
    }
Esempio n. 8
0
    public void DoSkill()
    {
        List <Life> targets = GetBuildSkillTarget();

        if (targets.Count > 0)
        {
            foreach (Life t in targets)
            {
                GridActionCmd action = null;
                if (t is Role)
                {
                    action = (t as Role).CurrentAction;
                }
                SkillReleaseInfo Info = SkillRelease(m_Parent, t, action, m_skill);
                t.ApplyDamage(Info, null);
            }
        }
    }
Esempio n. 9
0
    public override void GameOver(bool isWin)
    {
        base.GameOver(isWin);
        if (m_CurrentAction != null)
        {
            m_CurrentAction.SetDone();
        }
        if (isWin)
        {
            m_CurrentAction = new GridActionCmdWin();
        }
        else
        {
            m_CurrentAction = new GridActionCmdFaile();
        }

        m_CurrentAction.SetTarget(this);
        m_CurrentAction.Update();
    }
Esempio n. 10
0
    /// <summary>
    /// 到攻击目标位置
    /// </summary>
    private void DoToAttackPos()
    {
        m_Owner.m_Skin.SetVisable(true);
        if (m_petFollow)
        {
            m_petFollow.m_IsFollow = false;
        }

        if (!m_bGotoAttackPos)
        {
            m_bGotoAttackPos = true;
            GameObject posgo = m_Owner.m_Skin.ProPerty.HelpPoint.GetVauleByKey(HelpPointName.FirePos);
            if (posgo != null)
            {
                GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", "1003041", posgo.transform.position, posgo.transform);
                if (gae != null)
                {
                    GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(10f);
                    gae.AddAction(ndEffect);
                    m_effect = gae.gameObject;
                }
            }
        }
        if (m_CurrentAction == null)
        {
            m_CurrentAction = m_run.GetNextAction();
        }
        else if (m_CurrentAction.IsDone())
        {
            GridActionCmd preaction = m_CurrentAction;
            m_CurrentAction = m_run.GetNextAction();

            DoPathEvent(preaction);
        }
        if (m_CurrentAction != null && m_petState != Pet1002State.Follow)
        {
            m_CurrentAction.Update();
        }
        else
        {
            DoAttack();
        }
    }
Esempio n. 11
0
    public void DoPathEvent(GridActionCmd preaction)
    {
        LifeMCamp   Camp     = (m_Owner.m_Core.m_Camp == LifeMCamp.ATTACK) ? LifeMCamp.DEFENSE :LifeMCamp.ATTACK;
        List <Life> RoleList = new List <Life>();

        CM.SearchLifeMListInBoat(ref RoleList, LifeMType.SOLDIER | LifeMType.SUMMONPET, Camp);
        if (m_CurrentAction is GridActionCmdStair || m_CurrentAction is GridActionCmdJump || m_CurrentAction is GridActionCmdFall)
        {
            AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_INA), RoleList);
        }
        else if (preaction is GridActionCmdStair || preaction is GridActionCmdJump || preaction is GridActionCmdSpecialJump ||
                 m_CurrentAction is GridActionCmdFallDown)
        {
            AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_FMA), RoleList);
        }
        else if (m_CurrentAction is GridActionCmdWalk)
        {
            AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_TM), RoleList);
        }
    }
Esempio n. 12
0
    /// <summary>
    /// 释放技能主逻辑
    /// </summary>
    protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex)
    {
        bool IsRelease = false;

        if (RoleList.Count > 0)
        {
            IsRelease = true;
            foreach (Life w in RoleList)
            {
                bool          InterruptSkill = false;
                GridActionCmd action         = null;
                if (w is Role)
                {
                    action = (w as Role).CurrentAction;
                }
                SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo);
                w.ApplyDamage(Info, m_thisT);
            }
        }
        return(IsRelease);
    }
Esempio n. 13
0
    /// <summary>
    /// 释放技能主逻辑
    /// </summary>
    protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex)
    {
        bool IsRelease = false;

        if (RoleList.Count > 0)
        {
            IsRelease = true;
            foreach (Life w in RoleList)
            {
                GridActionCmd action = null;
                if (w is Role)
                {
                    action = (w as Role).CurrentAction;
                }
                SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo);
                w.ApplyDamage(Info, m_thisT);
            }
            m_fAttackTrigger = Time.time;
            m_goEffect1003031.SetActive(true);
        }
        return(IsRelease);
    }
Esempio n. 14
0
    /// <summary>
    /// 释放技能主逻辑
    /// </summary>
    protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex)
    {
        bool IsRelease = false;

        if (RoleList.Count > 0)
        {
            IsRelease = true;
            SetAnimator(Build_AnimatorState.Trigger30000);
            foreach (Life w in RoleList)
            {
                //Life w = RoleList[0];
                GridActionCmd action = null;
                if (w is Role)
                {
                    action = (w as Role).CurrentAction;
                }
                SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo);
                w.ApplyDamage(Info, m_thisT);
            }
            //m_Skill.PropSkillInfo.m_LifeTarget=null;
        }
        return(IsRelease);
    }
Esempio n. 15
0
    /// <summary>
    /// 释放技能主逻辑
    /// </summary>
    protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex)
    {
        bool IsRelease = false;

        if (RoleList.Count > 0)
        {
            m_fAttackTimer = Time.time;
            IsRelease      = true;
            m_TriggerIng   = true;
            SetAnimator(Build_AnimatorState.Trigger30000);
            SoundPlay.Play("Trap/trap_prison", false, false);
            foreach (Life w in RoleList)
            {
                GridActionCmd action = null;
                if (w is Role)
                {
                    action = (w as Role).CurrentAction;
                }
                SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo);
                w.ApplyDamage(Info, m_thisT);
            }
        }
        return(IsRelease);
    }
Esempio n. 16
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);
    }
Esempio n. 17
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);
    }
Esempio n. 18
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);
    }
Esempio n. 19
0
    /// <summary>
    /// 技能释放
    /// </summary>
    /// <param name="Attack">技能释放者</param>
    /// <param name="Defense">受击者</param>
    /// <param name="DefenseAction">防守方,攻击处于的状态</param>
    /// <returns>技能伤害值</returns>
    public SkillReleaseInfo SkillRelease(Life Attack, Life Defense, GridActionCmd DefenseAction, SkillInfo skill)
    {
        //异常处理
        AttackResult     Result = AttackResult.Normal;
        SkillReleaseInfo Info   = new SkillReleaseInfo();

        Info.m_InterruptSkill = false;
        Info.m_MakeStatus     = new List <StatusType> ();
        Info.m_bImmunity      = false;
        Info.m_Damage         = 0;
        Info.m_struckeffect   = "";
        Info.Result           = AttackResult.Normal;
        Info.HitAttributeType = skill.m_AttributeType;
        if (Attack == null || Defense == null || skill == null)
        {
            Debug.Log(Attack + "," + Defense + "," + skill.m_name);
            return(Info);
        }
        if (Defense is Role && (Defense as Role).NoDie)
        {
            return(Info);
        }
        //处于攻击中(过了前要阶段)

        /*if(DefenseAction != null && DefenseAction is GridActionCmdAttack)
         * {
         *      if((DefenseAction as GridActionCmdAttack).IsPlayed() == true)
         *      return Info;
         * }*/
        Info.HitType        = (AttackType)skill.m_attacktype;
        Info.m_struckeffect = skill.m_struckeffect;
        //判断是否技能免疫 ,免疫技能不受到伤害及状态。
        AttackType Type = (AttackType)skill.m_attacktype;
        bool       ret  = ImmunitySkill(Type, skill.m_type, Defense.m_Status);

        if (ret == true)
        {
            Info.m_bImmunity = true;
            Info.Result      = AttackResult.Immunity;
            return(Info);
        }
        //根据m_interrupt_skill 判断受击方技能是否打断
        if (skill.m_interrupt_skill == 1)
        {
            if (skill is SoldierSkill)
            {
                float random = Random.Range(0, 1f);
                if (Defense.m_Attr.Level <= (skill as SoldierSkill).m_rankslevel || random <= (skill as SoldierSkill).m_status_hitratio)
                {
                    Info.m_InterruptSkill = true;
                }
            }
            else
            {
                Info.m_InterruptSkill = true;
            }
        }

        if (Attack.m_Attr == null || Defense.m_Attr == null)
        {
            return(Info);
        }
        //计算技能伤害
        int Damage  = 0;
        int regenhp = 0;

        if (Attack.m_Core.m_Camp == Defense.m_Core.m_Camp)
        {
            regenhp = CalcSkillRegenHP(Attack.m_Attr, Defense.m_Attr, ref Result, skill);
        }
        else
        {
            Damage = CalcSkillDamage(Attack.m_Attr, Defense.m_Attr, ref Result, skill);
        }
        Damage = CalcDistanInfo(Attack.m_Attr, Defense.m_Attr, Damage);
        Damage = CalcAttributableSkillDamage(skill.m_AttributeType, Defense.m_Attr, Damage);
        //计算技能治疗量
        //盾抵抗伤害
        if (Defense.m_Status != null)
        {
            Damage = Damage - Defense.m_Status.ReduceHpbyShield((AttackType)skill.m_attacktype, Damage);
        }
        //miss 不产生状态
        if (Result == AttackResult.Miss)
        {
            Info.Result = AttackResult.Miss;
            return(Info);
        }
        else if (Result == AttackResult.Crit)
        {
            Info.Result = AttackResult.Crit;
        }

        if ((Defense.m_Attr.Hp - Damage) > 0)
        {
            //产生debuff,根据ememy_status,判断debuff中是包含打断技能状态
            if (StatusDeBuff(Defense, skill) == true)
            {
                Info.m_InterruptSkill = true;
            }
            //魅惑状态下的BUFF效果无效
            if (!Attack.m_Attr.Charmed && StatusBuff(Defense, skill) == true)
            {
                Info.m_InterruptSkill = true;
            }
            if (Defense is Building)
            {
                StatusBuildDeBuff(Defense);
            }
        }



        //else Damage = Defense.HP;
        //判断受击方受到的伤害值,是否大于可被打断伤害值。
        int LimitHp = Defense.m_Attr.Hp * ConfigM.GetSkillData0() / 100;

        if (Damage > LimitHp)
        {
            Info.m_InterruptSkill = true;
        }
        if (Attack.m_Attr.Vampire > 0)
        {
            int vampriehp = CalcVampireHP(Attack.m_Attr, Damage);
            Attack.HP += vampriehp;
            Attack.StatusUpdateHp(vampriehp);
        }

        if (Attack.m_Core.m_Camp == Defense.m_Core.m_Camp)
        {
            Info.m_Damage = regenhp;
        }
        else
        {
            Info.m_Damage = -Damage;
        }

        return(Info);
    }
Esempio n. 20
0
    /// <summary>
    /// Update 调用
    /// </summary>
    public override void Update()
    {
        SoldierSkill conditionskillinfo = new SoldierSkill();
        bool         isnewaction        = false;

        if (CurrentAction == null)
        {
            CurrentAction = run.GetNextAction();
            DoPathEvent();
#if UNITY_EDITOR_LOG
            FileLog.write(m_Owner.SceneID, m_Owner.SceneID + ",CurrentAction:" + CurrentAction + ",mStart:" + CurrentAction.m_Start + ",mEnd:" + CurrentAction.m_End
                          + ",dir:" + CurrentAction.m_Dir
                          + ",mDuration:" + CurrentAction.m_Duration + ",mattackid:" + CurrentAction.m_AttackSceneID + ",mGrid:" + m_Owner.MapPos
                          + ",mNGrid:" + m_run.NGrid + ",deep:" + m_run.RankDeep + ",reject" + m_run.Reject);
#endif
        }
        else if (CurrentAction.IsDone() /*&& !m_Owner.WaitServer*/)
        {
            if (m_Owner.m_bTrunBack)
            {
                m_Owner.TurnsInto(false);
            }
            else
            {
#if UNITY_EDITOR_LOG
                string str = "skill:" + m_Owner.PropAttackSkillInfo.m_type + "  ,pos" + m_Owner.m_thisT.localPosition + ",mGrid:" + m_Owner.MapPos + ",mNGrid:" + m_run.NGrid + ",deep:" + m_run.RankDeep + ",reject" + m_run.Reject
                             + ", attackstation:" + run.AttackStation + ", Nattackstation:" + run.NAttackStation + ",  olddir:" + m_Owner.WalkDir;
#endif
                isnewaction = true;
                m_ActionList.Add(CurrentAction);
                CurrentAction = run.GetNextAction();
#if UNITY_EDITOR_LOG
                if (CurrentAction != null)
                {
                    FileLog.write(m_Owner.SceneID, m_Owner.SceneID + ",CurrentAction1111:" + CurrentAction + ",mStart:" + CurrentAction.m_Start + ",mEnd:" + CurrentAction.m_End
                                  + ",dir:" + CurrentAction.m_Dir + ", new dir:" + m_Owner.WalkDir + ",mDuration:" + CurrentAction.m_Duration + ",mattackid:" + CurrentAction.m_AttackSceneID + str + "newGrid" + m_Owner.MapPos + " time:" + Time.realtimeSinceStartup + ", curpos :" + m_Owner.m_thisT.localPosition);
                }
#endif

                m_Owner.m_Hit = false;
                if (!m_Owner.m_isDead)
                {
                    if (m_ActionList[m_ActionList.Count - 1] is GridActionCmdConditionSkill && !(m_ActionList[m_ActionList.Count - 1] as GridActionCmdConditionSkill).RealDone())
                    {
                        GridActionCmdConditionSkill cs = m_ActionList[m_ActionList.Count - 1] as GridActionCmdConditionSkill;

                        if (!(CurrentAction is GridActionCmdJump ||
                              CurrentAction is GridActionCmdStair ||
                              CurrentAction is GridActionCmdFall ||
                              CurrentAction is GridActionCmdSpecialJump ||
                              CurrentAction is GridActionCmdHitByBuild ||
                              CurrentAction is GridActionCmdJumpDown ||
                              CurrentAction is GridActionCmdJumpUp)
                            )
                        {
                            bool ismove = false;
                            if (CurrentAction is GridActionCmdWalk)
                            {
                                ismove = true;
                            }
                            cs.ExtendDuration(CurrentAction.m_Duration, CurrentAction.m_Start, CurrentAction.m_End, ismove);
#if UNITY_EDITOR_LOG
                            FileLog.write(m_Owner.SceneID, m_Owner.SceneID + ",CurrentAction4444:" + m_Owner.m_thisT.localPosition);
#endif
                            CurrentAction = cs;
                        }
                    }
                    else if (RoleSkill.CheckConditionSkillAction(m_Owner.m_SceneID, ref conditionskillinfo, true, m_Owner.m_SkillRelease))
                    {
#if UNITY_EDITOR_LOG
                        FileLog.write(m_Owner.SceneID, m_Owner.SceneID + ",CurrentAction3333:" + m_Owner.m_thisT.localPosition + "," + conditionskillinfo.m_type + "," + conditionskillinfo.m_name);
#endif
                        if (!(CurrentAction is GridActionCmdJump || CurrentAction is GridActionCmdStair || CurrentAction is GridActionCmdFall || CurrentAction is GridActionCmdSpecialJump))
                        {
                            bool ismove = false;
                            if (CurrentAction is GridActionCmdWalk)
                            {
                                ismove = true;
                            }
                            //Debug.Log(m_CurrentAction + "," + conditionskillinfo.m_type);
                            GridActionCmd action = null;
                            if (conditionskillinfo.m_ismove == 1)
                            {
                                action = RoleSkill.GetConditionSkillAction(m_Owner.m_SceneID, conditionskillinfo, CurrentAction.m_Start, CurrentAction.m_End, CurrentAction.m_Duration, ismove);
                            }
                            else
                            {
                                action = RoleSkill.GetConditionSkillAction(m_Owner.m_SceneID, conditionskillinfo, CurrentAction.m_Start, CurrentAction.m_Start, CurrentAction.m_Duration, ismove);
                            }

                            if (action != null && action is GridActionSkill)
                            {
                                if (m_Owner.m_Status.SeleStatusInterRupt(conditionskillinfo) == false)
                                {
                                    CurrentAction = action;
                                    run.ResetIndex(conditionskillinfo.m_ismove == 1);
                                }
                                else
                                {
                                    action.SetDone();
                                }
                            }
                        }
                    }
                    DoPathEvent();
                    m_Owner.m_SkillRelease = false;
                    if (CurrentAction != null)
                    {
                        List <IggWall> lw = new List <IggWall>();
                        MapGrid.GetWallList(ref lw, m_Owner.GetMapPos(), run.AttackStation);
                        foreach (IggWall w in lw)
                        {
                            w.OpenDoor(OpenDoorStyle.passDoor, m_Owner.m_Core.m_Camp, Mathf.Abs(m_Owner.GetMapPos().Unit - w.GetMapPos().Unit));
                        }
#if UNITY_EDITOR_LOG
                        FileLog.write(m_Owner.SceneID, run.PreGrid + "," + m_Owner.SceneID + ",CurrentAction2222:" + CurrentAction + ",mStart:" + CurrentAction.m_Start + ",mEnd:" + CurrentAction.m_End
                                      + ",dir:" + CurrentAction.m_Dir + "new dir" + m_Owner.WalkDir + ",mDuration:" + CurrentAction.m_Duration + ",mattackid:" + CurrentAction.m_AttackSceneID + str + "newGrid" + m_Owner.MapPos + " time:" + Time.realtimeSinceStartup + ", curpos :" + m_Owner.m_thisT.localPosition);
#endif
                    }
                }
            }
        }
        else
        {
            if (RoleSkill.CheckConditionSkillAction(m_Owner.m_SceneID, ref conditionskillinfo, false, m_Owner.m_SkillRelease))
            {
                if (CurrentAction is GridActionCmdAttack || CurrentAction is GridActionCmdConditionSkill)
                {
                    if (conditionskillinfo.m_ipriority > m_Owner.PropSkillInfo.m_ipriority)
                    {
                        CurrentAction.SetDone();
                        m_ActionList.Add(CurrentAction);
                        CurrentAction = RoleSkill.GetConditionSkillAction(m_Owner.m_SceneID, conditionskillinfo, m_Owner.m_thisT.localPosition, m_Owner.m_thisT.localPosition, 0f, false);
                    }
                }
            }
        }
        if (CurrentAction != null)
        {
            if (CurrentAction is GridActionCmdWalk)
            {
                List <int> rolelist = new List <int>();
                MapGrid    g        = MapGrid.GetMG(run.PreGrid);
                g.GetRoleList(ref rolelist);
                int bwalk = 0;
                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 == null)
                        {
                            continue;
                        }
                        if (l != m_Owner && l.m_Attr.Goorder >= m_Owner.m_Attr.Goorder)
                        {
                            if (l.CurrentAction is GridActionCmdWalk)
                            {
                                bwalk++;
                                if (l.m_Attr.Goorder == m_Owner.m_Attr.Goorder && l.SceneID < m_Owner.SceneID)
                                {
                                    bwalk--;
                                }
                            }
                        }
                    }
                }
                if (!isnewaction)
                {
                    if (bwalk == 0)
                    {
                        if (CurrentAction.m_TimeCount == 0 && m_Owner.m_ajustcount < m_Owner.m_ajustduration)
                        {
                            m_Owner.AdjustPosition(Time.deltaTime);
                        }
                        else
                        {
                            CurrentAction.Update();
                        }
                    }
                    else if (bwalk == 1 && CurrentAction.m_TimeCount == 0)
                    {
                        m_Owner.AdjustPosition(Time.deltaTime);
                    }
                }
                else
                {
                    if (bwalk > 0)
                    {
                        run.ChangeDeep(0);
                        //m_Owner.m_ajustcount = m_Owner.m_ajustduration;
                    }
                    else
                    {
                        m_Owner.m_ajustcount += m_Owner.m_ajustduration;
                    }
                }
            }
            else
            {
                CurrentAction.Update();
            }
            if (CurrentAction.TestNextDone())
            {
                if (CurrentAction is GridActionCmdAttack || CurrentAction is GridActionCmdCDStand ||
                    CurrentAction is GridActionCmdHit || CurrentAction is GridActionCmdSkillStand ||
                    CurrentAction is GridActionCmdFallDown || (CurrentAction is GridActionCmdConditionSkill && m_Owner.PropSkillInfo.m_ismove == 0))
                {
                    run.RegisterNextAction(false);
                }
                else
                {
                    run.RegisterNextAction();
                }
            }
        }
        else
        {
#if UNITY_EDITOR_LOG
            FileLog.write(m_Owner.m_SceneID, m_Owner.m_SceneID + "创建action出错" + ",技能类型:" + m_Owner.PropSkillInfo.m_type);
            Debug.LogError(m_Owner.m_thisT.gameObject.name + m_Owner.m_SceneID + "创建action出错" + ",技能类型:" + m_Owner.PropSkillInfo.m_type);
#endif
        }
    }
Esempio n. 21
0
 public static SkillReleaseInfo CalcDamage(Life Attack, Life Defense, GridActionCmd DefenseAction, SkillInfo skill)
 {
     return(Attack.m_Skill.SkillRelease(Attack, Defense, DefenseAction, skill));
 }
Esempio n. 22
0
    /// <summary>
    /// 释放技能主逻辑
    /// </summary>
    protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex)
    {
        bool IsRelease = false;

        m_AttackRoleList.Clear();
        m_SkillReleaseInfoList.Clear();
        if (RoleList.Count > 0)
        {
            if (nAttackIndex == 0)
            {
                IsRelease      = true;
                m_fAttackTimer = Time.time;
                Vector3 posSrc  = m_goEffectLeft1905021_03.transform.position;
                Vector3 posRole = new Vector3(RoleList[0].GetPos().x, RoleList[0].GetPos().y + 1.5f, RoleList[0].GetPos().z);
                float   fRate   = Vector2.Distance(posSrc, posRole) / 3.8f;
                m_goEffectLeft1905021_03.transform.localScale = new Vector3(fRate, 1.0f, 1.0f);
                float fAngle = NdUtil.V2toAngle(posSrc, posRole, Vector2.right);
                m_goEffectLeft1905021_03.transform.rotation = Quaternion.Euler(new Vector3(0, 180f, fAngle));

                posSrc = m_goEffectRight1905021_03.transform.position;
                fRate  = Vector2.Distance(posSrc, posRole) / 3.8f;
                m_goEffectRight1905021_03.transform.localScale = new Vector3(fRate, 1.0f, 1.0f);
                fAngle = NdUtil.V2toAngle(posSrc, posRole, Vector2.right);
                m_goEffectRight1905021_03.transform.rotation = Quaternion.Euler(new Vector3(0, 180f, fAngle));


                foreach (Life w in RoleList)
                {
                    IsRelease = true;
                    GridActionCmd action = null;
                    if (w is Role)
                    {
                        action = (w as Role).CurrentAction;
                    }
                    SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo);
                    m_SkillReleaseInfoList.Add(Info);
                    m_AttackRoleList.Add(w);
                }
                m_bAttack = true;
            }
            int nRoleCount = m_AttackRoleList.Count;
            for (int nCnt = 0; nCnt < nRoleCount; nCnt++)
            {
                Life w = m_AttackRoleList[nCnt];

                if (!w.InBoat || w.isDead)
                {
                    continue;
                }
                SkillReleaseInfo info  = m_SkillReleaseInfoList[nCnt];
                BuildSkill       rs    = m_Skill as BuildSkill;
                float            power = rs.PropSkillInfo.GetAttackPower(nAttackIndex + 1);
                info.m_Damage    = (int)(info.m_Damage * power);
                info.mOwnerLevel = m_Attr.Level;
                w.ApplyDamage(info, m_thisT);
            }
            if (nRoleCount > 0)
            {
                SoundPlay.Play("Trap/trap_electricshock", false, false);
            }
        }
        return(IsRelease);
    }
Esempio n. 23
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);
    }