public void Damage(float damage)
 {
     health -= damage;
     healthController.UpdateUI();
     if (health <= 0f && !gameObject.CompareTag("Ground"))
     {
         Destroy(gameObject);
     }
 }
Пример #2
0
    public void Damage(int damage)
    {
        health -= damage;
        healthController.UpdateUI();
        string tag = gameObject.tag;

        if (health <= 0f && tag != "Ground")
        {
            Explode();
            Destroy(gameObject);
            if (tag == "Enemy")
            {
                int enemiesShot = gameController.GetEnemiesKilled(name);
                gameController.UpdateEnemiesKilled(name, enemiesShot + 1);
                gameController.AddPoints(points);
                gameController.SetScoreText("        Score: " + gameController.GetScore());
            }
        }
    }