Exemplo n.º 1
0
 private void LoseHealth(int damage)
 {
     if (!invincible)
     {
         vCam.ScreenShake();
         SoundManager.instance.PlaySingle(enemyHurt);
         invincible = true;
         Invoke(nameof(StopInvincible), invincibilityTime);
         health -= damage;
         if (!CheckIfDead())
         {
             _ = Instantiate(hurtParticles, transform.position, Quaternion.identity);
         }
     }
 }
Exemplo n.º 2
0
 public void PowerUp()
 {
     vCam.ScreenShake();
     controls.Gameplay.Disable();
     rb.velocity     = Vector2.zero;
     rb.gravityScale = 0;
     savedGame.Play();
     Invoke(nameof(ResetGravity), 2f);
 }