Beispiel #1
0
 public void Die()
 {
     if (deathHandler != null)
     {
         deathHandler.OnDeath();
     }
 }
Beispiel #2
0
 void OnCollisionEnter2D(Collision2D collisionToDetect)
 {
     if (collisionToDetect.gameObject.CompareTag(StringNamesInfo.BULLET_tag))
     {
         deathHandler.OnDeath();
         Destroy(collisionToDetect.gameObject);
         StartCoroutine(Death(StringNamesInfo.EXPLODE_inAir_animation_name));
     }
     if (collisionToDetect.gameObject.CompareTag(StringNamesInfo.GROUND_tag))
     {
         StartCoroutine(Death(StringNamesInfo.EXPLODE_onGround_animation_name));
         StartCoroutine(CameraShakingScript.Instance.ShakeCameraIEnumerator(scaleAmount));
         if (meteorSoundExplodeOnGround && SettingsScript.EffectVolume > 0.01f)
         {
             meteorSoundExplodeOnGround.volume = SettingsScript.EffectVolume * transform.localScale.x / 100;
             meteorSoundExplodeOnGround.Play();
         }
         GameManager.Instance.Health -= lifeCost;
     }
 }