Beispiel #1
0
    public void TakeDamage(int amountDamage)
    {
        currentHealth -= amountDamage;
        if (currentHealth < 0)
        {
            Vector3    xyz      = new Vector3(0, -180, 0);
            GameObject particle = Instantiate(particleEffect, transform.position, Quaternion.Euler(xyz));

            purse.AddCash(cashPoints); //add cash to purse
            DeathEvent.Invoke();       ///notify towers that I am killed
            Destroy(this.gameObject);  //Get rid of object
            Destroy(particle, 2f);
            enemyCount -= 1;
            Debug.Log(enemyCount);


            /*if(enemyCount == 0)
             * {
             *  GameObject.FindGameObjectWithTag("Enemy").GetComponent<Enemy>().over();
             * }*/
        }
        else
        {
            healthBar.Damage(currentHealth, startingHealth);
        }
    }
Beispiel #2
0
 public void TakeDamage(int amount)
 {
     health -= amount;
     if (health <= 0)
     {
         message.AddCash(amount);
         Destroy(this.gameObject);
     }
     else
     {
         healthBar.Damage(health, startingHealth);
     }
 }
Beispiel #3
0
 public void TakeDamage(int amountDamage)
 {
     currentHealth -= amountDamage;
     StartCoroutine(FlashColor());
     if (currentHealth < 0)
     {
         purse.AddCash(cashPoints);
         Destroy(this.gameObject);
     }
     else
     {
         healthBar.Damage(currentHealth, startingHealth);
     }
 }
Beispiel #4
0
 public void TakeDamage(int amountDamage)
 {
     currentHealth -= amountDamage;
     if (currentHealth <= 0)
     {
         purse.AddCash(cashPoints); // Add cash to purse
         //DeathEvent.Invoke(); // Notify towers that I am killed
         Destroy(this.gameObject);  // Get rid of object
     }
     else
     {
         healthBar.Damage(currentHealth, startingHealth);
     }
 }