internal void CollisionWithEnemy() { var colliders = Physics.OverlapSphere(transform.position, _bulletConfig.Radius); foreach (var collider in colliders) { if (collider.tag.Equals("Enemy")) { var item = collider.gameObject.GetComponent <EnemyObject>(); item.GetDamage(_bulletConfig.Damage); } else if (collider.tag.Equals("CompositeEnemy")) { var item = collider.gameObject.GetComponent <CompositeEnemy>(); item.GetDamage(_bulletConfig.Damage); } if (collider.tag.Equals("Platform") || collider.tag.Equals("CompositeEnemy") || collider.tag.Equals("Enemy")) { if (!_bulletConfig.name.Equals("Bull3")) { _explosionPrefab.transform.position = transform.position; _explosionPrefab.PlayParticle(); ReturnToPool(); } } } }
internal virtual void GetDamage(int damage) { scoreManager.AddScore(damage); currentHealth -= damage; _healthBar.value = (float)currentHealth / _enemyConfig.Health; if (currentHealth < 1) { currentParticles.transform.position = transform.position; currentParticles.PlayParticle(); ReturnToPool(); DOTween.Kill(transform); currentHealth = _enemyConfig.Health; } }