Exemplo n.º 1
0
    public override void DoBeforeEntering()
    {
        //m_MonsterBehaviour.ClientEndPos.Value = null;
        m_currentSkillBase = this.m_MonsterBehaviour.m_SkillBaseList.FirstOrDefault(p => p.SkillId == m_currentSkillID);
        if (m_currentSkillBase == null)
        {
            TraceUtil.Log(SystemModel.Common, TraceLevel.Error, "找不到相关技能");
            TraceUtil.Log(SystemModel.NotFoundInTheDictionary, TraceLevel.Error, "找不到相关技能");
        }
        else
        {
            m_currentSkillBase.AddActionDelegate(ActionHandle);
            m_currentSkillBase.AddSkillBulletFireDelegate(FireBulletHandle);
            m_currentSkillBase.AddSkillEffectFireDelegate(FireSkillActionEffect);
            m_currentSkillBase.AddSkillOverDelegate(ActionOverHandle);
            m_currentSkillBase.Fire();
        }


        if (Vector3.Distance(m_MonsterBehaviour.ThisTransform.position, m_shouldPos) >= 10)
        {
            //相差太大的情况:
            m_MonsterBehaviour.MoveToPoint(m_shouldPos);
        }
        else
        {
            m_MonsterBehaviour.MoveToPoint(m_shouldPos);
        }

        m_MonsterBehaviour.ThisTransform.LookAt(new Vector3(m_attackLookAtPos.x, m_MonsterBehaviour.ThisTransform.position.y, m_attackLookAtPos.z));

        //清零位移
        m_displacement = 0;

        //清除路点信息
        m_MonsterBehaviour.PointQueue.Clear();
        if (GameManager.Instance.CurrentGameMode == GameMode.SINGLE_PLAYER)
        {
            float xValue, yValue;
            this.m_MonsterBehaviour.ThisTransform.position.SetToServer(out xValue, out yValue);
            SMsgFightCommand_CS sMsgFightCommand_CS = new SMsgFightCommand_CS();
            sMsgFightCommand_CS.uidFighter  = this.m_MonsterBehaviour.RoleDataModel.SMsg_Header.uidEntity;
            sMsgFightCommand_CS.nFightCode  = m_currentSkillBase.SkillId;
            sMsgFightCommand_CS.byType      = 1;
            sMsgFightCommand_CS.fighterPosX = xValue;
            sMsgFightCommand_CS.fighterPosY = yValue;

            NetServiceManager.Instance.BattleService.SendFightCommandCS(sMsgFightCommand_CS);
        }
        m_MonsterBehaviour.FixMonsterYToOrigin();
        base.DoBeforeEntering();
    }