Ejemplo n.º 1
0
    void Start()
    {
        if (this.gameObject.GetComponent <AnimatorComponent>() == null)
        {
            m_AnimatorManager = this.gameObject.AddComponent <AnimatorComponent>();
        }
        else
        {
            m_AnimatorManager = this.gameObject.GetComponent <AnimatorComponent>();
        }
        //
        if (this.gameObject.GetComponent <InjuredComponent>() == null)
        {
            m_InjuredComponent = this.gameObject.AddComponent <InjuredComponent>();
        }
        else
        {
            m_InjuredComponent = this.gameObject.GetComponent <InjuredComponent>();
        }

        if (this.gameObject.GetComponent <NpcAICtrl>() == null)
        {
            m_NpcAICtrl = this.gameObject.AddComponent <NpcAICtrl>();
        }
        else
        {
            m_NpcAICtrl = this.gameObject.GetComponent <NpcAICtrl>();
        }
        m_NpcAICtrl.NpcAICtrlStart(this);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 技能命中
    /// </summary>
    /// <param name="skillActionProperty"></param>
    void SkillHit(SkillActionProperty skillActionProperty)
    {
        List <IObject> objList  = GetTargets(skillActionProperty);
        int            objCount = objList.Count;

        if (objCount < 0)
        {
            return;
            //PauseAnimtor(skillActionProperty.mAttackerTime);
        }

        if (skillActionProperty.mCameraShakeNumber > 0)
        {
            _CameraShake.Shake(skillActionProperty.mCameraShakeNumber,
                               skillActionProperty.mCameraShakeDistance,
                               skillActionProperty.mCameraShakeSpeed,
                               skillActionProperty.mShakeRotationX,
                               skillActionProperty.mShakeDecay);
        }

        for (int i = 0; i < objCount; ++i)
        {
            IObject enemy = objList[i];
            if (enemy == null)
            {
                continue;
            }

            InjuredComponent injCom = enemy.GetComponent <InjuredComponent>();
            if (injCom == null)
            {
                continue;
            }

            // 如果是主角达到敌人,增加连击数
            if (mObj is CRoleObject)
            {
                ObjectManager.mRole.IncComboCount();
                FightManager.Instance.mFightUI.SetComboNumber(ObjectManager.mRole.ComboCount);
            }

            EffectManager.Instance.SkillHitEffect(skillActionProperty.mHurtEffectId, injCom.mObj.mGameObject);
            EffectManager.Instance.SkillHitHighLightEffect(injCom.mObj.mGameObject);
            StartCoroutine(RemoveHighlight(injCom.mObj.mGameObject));

            if (skillActionProperty.mDamageStatus == 0)
            {
                injCom.InjuredSkillType(mObj, skillActionProperty);
            }
            else if (skillActionProperty.mDamageStatus == 1)
            {
                injCom.MoveSkillInjured(0.9f, mObj);
            }
            else if (skillActionProperty.mDamageStatus == 2)
            {
                injCom.HeightSkillInjured(0.2f, mObj.mTransform, skillActionProperty);
            }
        }
    }