/// <summary> /// Receive the damage. If <c>_hp</c> is 0, it will be deactivated. /// </summary> private void GetDamage() { _hitFlash.Flash(); if (--_hp == 0) { EnemyManager.Instance.DestroyEnemy(); gameObject.SetActive(false); } }
private void OnTriggerEnter(Collider other) { if (!_isDestroyable || other.gameObject.layer != _playerLayer) { return; } _hitFlash.Flash(); if (--_hp == 0) { gameObject.SetActive(false); } }