コード例 #1
0
ファイル: PlayerAttack.cs プロジェクト: garzaa/vapor-trails
 override protected void OnTriggerEnter2D(Collider2D otherCol)
 {
     if (attackedTags.Contains(otherCol.tag))
     {
         //if it takes energy to inflict damage, don't run any of the hit code
         if (costsEnergy && energyCost > attackerParent.GetComponent <PlayerController>().CheckEnergy())
         {
             return;
         }
         Hurtbox hurtbox = otherCol.GetComponent <Hurtbox>();
         if (hurtbox != null && hurtbox.OnHit(this))
         {
             OnAttackLand(hurtbox.GetParent(), hurtbox);
         }
     }
 }
コード例 #2
0
ファイル: Attack.cs プロジェクト: garzaa/vapor-trails
 virtual protected void OnTriggerEnter2D(Collider2D otherCol)
 {
     if (!ExtendedAttackCheck(otherCol))
     {
         return;
     }
     if (attackedTags.Contains(otherCol.gameObject.tag))
     {
         if (otherCol.GetComponent <Hurtbox>() == null)
         {
             return;
         }
         Hurtbox hurtbox = otherCol.GetComponent <Hurtbox>();
         if (hurtbox.OnHit(this))
         {
             OnAttackLand(hurtbox.GetParent(), hurtbox);
         }
     }
 }