Example #1
0
 private void ProcessHit(GC_DamageDealer damageDealer)
 {
     health -= damageDealer.GetDamage();
     damageDealer.Hit();
     if (health <= 0)
     {
         Die();
     }
 }
Example #2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        GC_DamageDealer damageDealer = other.gameObject.GetComponent <GC_DamageDealer>();

        if (!damageDealer)
        {
            return;
        }
        ProcessHit(damageDealer);
    }