Esempio n. 1
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. 2
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
        }
    }