예제 #1
0
 private void OnEnemyDeath()
 {
     _healthObject.SetActive(false);
     _spawnManager.EnemyDestroyed();
     _spawnManager.Explode(transform.position);
     Destroy(gameObject, 0.25f);
 }
예제 #2
0
 public void damage()
 {
     if (_shields != 0)
     {
         _shields--;
         switch (_shields)
         {
             case 2:
                 _shieldObj.GetComponent<SpriteRenderer>().color = _color_Yellow;
                 break;
             case 1:
                 _shieldObj.GetComponent<SpriteRenderer>().color = _color_Red;
                 break;
             case 0:
                 _shieldObj.SetActive(false);
                 break;
         }
     }
     else
     {
         CameraShake.Shake(shakeTime, shakeAmount);
         StartCoroutine(Controlerrumble());
         _health--;
         if (_health == 2)
         {
             _rightWing.SetActive(true);
         }
         else if (_health == 1)
         {
             _leftWing.SetActive(true);
         }
         else
         {
             _leftWing.SetActive(false);
             _rightWing.SetActive(false);
         }
         _uiManager.UpdateLives(_health);
         if (_health < 1)
         {
             _spawnManager.onPlayerDeath();
             _spawnManager.Explode(transform.position);
             InputSystem.ResetHaptics();
             Destroy(this.gameObject);
         }
     }
 }