Example #1
0
 /// <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);
     }
 }
Example #2
0
        private void OnTriggerEnter(Collider other)
        {
            if (!_isDestroyable || other.gameObject.layer != _playerLayer)
            {
                return;
            }

            _hitFlash.Flash();
            if (--_hp == 0)
            {
                gameObject.SetActive(false);
            }
        }