Пример #1
0
        private void OnTriggerEnter(Collider other)
        {
            Collider[] colliders = Physics.OverlapSphere(transform.position, explosionRadius);
            foreach (Collider collider in colliders)
            {
                HealthAndDamage healthAndDamage = collider.GetComponent <HealthAndDamage>();
                if (healthAndDamage != null)
                {
                    healthAndDamage.ReduceHealth(damageAmountSetter.damageAmount);
                }
            }

            CameraShaker.Instance.ShakeOnce(3, 3, 2, 0.3f);
            Instantiate(explosionEffect, transform.position, Quaternion.identity);
            Destroy(gameObject);
        }