示例#1
0
    public void DoDamage(float _damage)
    {
        //Debug.Log("Doing damage to: " + identity);
        health -= _damage;
        healthBar.fillAmount = health / maxHealth;
        if (isDead)
        {
            Debug.Log("If enemy is dead pass through this debug.log");
        }

        // Check if enemy is dead
        if (health <= 0 && !isDead)
        {
            isDead = true;

            Debug.Log("Setting enemy to dead passing object into spawnstate script which is a member of enemy spawner");
            spawnState.EnemyDead(thisEnemy);
        }
    }