public void HurtEnemy(float damageCaused)
 {
     EnemyCurrentHealth -= damageCaused;
     if (EnemyCurrentHealth <= 0)
     {
         enemyItemDrop.ItemDrop();
         NetworkServer.Destroy(transform.gameObject);
     }
 }
Example #2
0
    public void destroyObject()
    {
        gameObject.SetActive(false);

        if (gameObject.layer == 10)
        {
            EnemyItemDrop theEnemy = GetComponent <EnemyItemDrop>();
            theEnemy.ItemDrop();
            health = maxHealth;
            gameObject.GetComponent <GroundEnemy>().timedShot = false;
        }
        if (gameObject.layer == 11)
        {
            EnemyItemDrop theEnemy = GetComponent <EnemyItemDrop>();
            theEnemy.ItemDrop();
            health = maxHealth;
        }
    }