Exemple #1
0
    public override void OnExit()
    {
        AnimationConfig animConfig = CurrentActor.MainAnim.GetComponent <AnimationConfig>();

        if (null != animConfig && null != animConfig.Trail)
        {
            animConfig.Trail.ClearTrail();
        }
        {
            AttackActionCallback callback = CurrentActor.GetBodyParentObject().GetComponent <AttackActionCallback>();
            callback.enabled = false;
        }
        if (m_skillTarget != null && m_skillTarget != CurrentActor)
        {//面向目标
            Vector3 direction = m_skillTarget.RealPos - CurrentActor.RealPos;
            direction.y = 0;
            // 由于这里修改旋转,会导致Actor的RealPos不正确,所以这里不能乱转 [8/19/2014 tgame]
            //CurrentActor.MoveRotation(Quaternion.LookRotation(direction.normalized) * Quaternion.LookRotation(Vector3.forward));
        }
        m_effectObjList.Clear();
        if (m_skillInfo.IsSlashExist)
        {//显示BoxCollider
            if (CurrentActor.CenterCollider != null)
            {
                CurrentActor.CenterCollider.gameObject.layer = LayerMask.NameToLayer("Actor");
            }
        }
        if (null != CurrentActor.Combo)
        {//设置连接技的信息
            CurrentActor.Combo.SetConnetionInfo(m_skillInfo.SkillConnectionType);
        }

        StopPlaySkillEventAnimation();
        //隐藏body下的所有istrigger状态的collider
        CurrentActor.HideTriggerCollider();

        //停止播放所有武器动作
        CurrentActor.StopPlayWeaponsAnimation();
        //隐藏武器
        CurrentActor.ShowWeaponModelWithTable(false);
        //回馈位移动画
        CurrentActor.ApplyAnimationOffset();
    }
Exemple #2
0
    public override void OnEnter()
    {
        SyncPositionIfNeed();
        m_skillResultIDIndex = 0;
        if (null == m_skillInfo)
        {
            IsEnable = false;
            Debug.LogWarning("data error,skillID:" + m_skillID);
            return;
        }
        if (CurrentActor.Type == ActorType.enMain)
        {
            BattleArena.Singleton.SkillCombo.SetConnectionInfo((ENSkillConnectionType)m_skillInfo.SkillConnectionType);
            //if (m_skillInfo.SkillConnectionType != (int)ENSkillConnectionType.enNone &&
            //    m_skillInfo.SkillConnectionType != (int)ENSkillConnectionType.enNormal)
            //{
            //    BattleArena.Singleton.QTE.Succ(m_skillInfo.ID, (ENSkillConnectionType)m_skillInfo.SkillConnectionType);
            //}
        }
        if (m_skillInfo.TargetType == (int)ENTargetType.enNullTarget)
        {//无目标技能
            CurrentActor.StartCaution();
        }
        {     //动作播放列表
            if (m_skillInfo.IsPrepareExist)
            { //有起手动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enPrepare, m_skillInfo.PrepareMotion, 0));
            }
            if (m_skillInfo.IsSpellExist)
            {//有吟唱动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enSpell, m_skillInfo.SpellMotion, m_skillInfo.SpellTime));
            }
            if (m_skillInfo.IsSlashExist)
            {//有冲刺动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enSlash, m_skillInfo.SlashMotion, 0));
            }
            if (m_skillInfo.IsReleaseExist)
            {//有释放动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enRelease, m_skillInfo.ReleaseMotion, 0));
            }
            if (m_skillInfo.IsConductExist)
            {//有引导动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enConduct, m_skillInfo.ConductMotion, m_skillInfo.ConductTime));
            }
            if (m_skillInfo.IsEndConductExist)
            {//有引导结束动作
                m_animationNameList.Add(m_animationNameList.Count, new AttackStepInfo(Actor.ENSkillStepType.enEndConduct, m_skillInfo.EndConductMotion, 0));
            }
            m_curAttackStep = 0;
            RefreshActionRef();
            if (m_skillTarget != null && m_skillTarget != CurrentActor)
            {
                m_isSwitchRotation = true;
                if (CurrentActor.Type == ActorType.enMain)
                {
                    m_isSwitchRotation = true;
                }
                else
                {
                    m_isSwitchRotation = false;
                }
            }
        }
        {
            AttackActionCallback callback = CurrentActor.GetBodyParentObject().GetComponent <AttackActionCallback>();
            callback.enabled = true;
        }

        AnimationConfig animConfig = CurrentActor.MainAnim.GetComponent <AnimationConfig>();

        if (null != animConfig && null != animConfig.Trail)
        {
            animConfig.Trail.StartTrail(0.15f, 0.05f);
        }
        if (m_isSwitchRotation)
        {
            //m_startTime = Time.time;
            m_isPlay          = false;
            m_targetForward   = m_skillTarget.RealPos - CurrentActor.RealPos;
            m_targetForward.y = 0;
            m_targetForward.Normalize();
            float currotateSpeed = Vector3.Angle(CurrentActor.MainObj.transform.forward, m_targetForward);
            if (CurrentActor.Type == ActorType.enNPC)
            {
                NPC npc = CurrentActor as NPC;
                m_fRotateSpeed = npc.CurrentTableInfo.SwitchRotateSpeed;
            }
            else
            {
                m_fRotateSpeed = CurrentActor.PropConfig.SwitchRotateSpeed;
            }
            float fDuration = currotateSpeed / m_fRotateSpeed;
            if (fDuration > GameSettings.Singleton.m_attackRotateTime)
            {
                m_fRotateSpeed = GameSettings.Singleton.m_attackRotateSpeed;
            }
        }
        else
        {
            m_isPlay = true;
            if (m_skillTarget != null && m_skillTarget != CurrentActor)
            {//面向目标
                Vector3 direction = m_skillTarget.RealPos - CurrentActor.RealPos;
                direction.y = 0;
                direction.Normalize();
                CurrentActor.MoveRotation(Quaternion.LookRotation(direction.normalized) * Quaternion.LookRotation(Vector3.forward));
            }
        }
    }