예제 #1
0
        protected override void OnTriggerEnter(Collider col)
        {
            if (col.gameObject.layer == (int)ObjectLayer.Player)
            {
                RealAttack = BasicAttack * AttackFactor;
                //传参给Player告知受伤
                TransformForward = EnemyMedi.EnemyMono.transform.forward;
                PlayerHurtAttr.ModifyAttr((int)RealAttack, VelocityForward, VelocityVertical, TransformForward, canDefeatedFly, DefeatedDown);
                if (IsOnlyPlayer)
                {
                    if (OnlyPlayerMono == null)
                    {
                        OnlyPlayerMono = col.GetComponent <IPlayerMono>();
                    }
                    // 击倒在地会由Hurt判断
                    OnlyPlayerMono.Hurt(PlayerHurtAttr);
                }
                if (hitEffectPath != string.Empty)
                {
                    resourcesMgr.LoadAsset(hitEffectPath, true, transform.position, Quaternion.identity);
                }

                //HasHit = true;
                //OnWeaponHit.Invoke();
            }
        }  // end_function
예제 #2
0
 protected override void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.layer == (int)ObjectLayer.Player)
     {
         RealAttack = BasicAttack * AttackFactor;
         //传参给Player告知受伤
         PlayerHurtAttr.ModifyAttr((int)RealAttack, VelocityForward, VelocityVertical, TransformForward, canDefeatedFly);
         if (IsOnlyPlayer)
         {
             if (OnlyPlayerMono == null)
             {
                 OnlyPlayerMono = col.GetComponent <IPlayerMono>();
             }
             OnlyPlayerMono.Hurt(PlayerHurtAttr);
         }
         else
         {
             col.GetComponent <IPlayerMono>().Hurt(PlayerHurtAttr);
         }
     }
 }  // end_function