public void Damage(int damage, Bullet bullet) { life -= damage; if (life < 1) { gameManager.AddPoints(pointsToAdd); //verificar se foi o último inimigo a ser retirado enemiesManager.CheckGameOver(gameObject); audioSource.PlayOneShot(destroy, 1); Destroy(gameObject); } else { audioSource.PlayOneShot(shield, 1); } WhatToDoWithBullet(bullet); }
public void Damage(GameObject enemy) { audioSource.PlayOneShot(soundLifeLost); life--; if (life < 0) { Debug.Log("Player Movement ativou fim do jogo"); gameManager.GameOver(1); Destroy(gameObject); return; } if (enemy != null) { enemiesManager.CheckGameOver(enemy); Destroy(enemy); } gameManager.UpdateLife(life); StartCoroutine("Tilt"); }