private void ProcessShieldHit(ShieldDmgDealer shieldDmgDealer) { shieldHealth -= shieldDmgDealer.GetShieldDamage(); shieldDmgDealer.Hit(); GameObject shieldPing = Instantiate(shieldVFX, transform.position, Quaternion.Euler(180, 0, 0)); Destroy(shieldPing, durationOfPing); }
private void OnTriggerEnter2D(Collider2D other) { ShieldDmgDealer shieldDmgDealer = other.gameObject.GetComponent <ShieldDmgDealer>(); DamageDealer damageDealer = other.gameObject.GetComponent <DamageDealer>(); // if (!damageDealer) { return; } if (shieldHealth > 0) { ProcessShieldHit(shieldDmgDealer); } if (shieldHealth <= 0) { ProcessHit(damageDealer); } }