Exemplo n.º 1
0
    public void TakeDamage(int damage)
    {
        HP -= damage;
        if (HP <= 0)
        {
            hpBar.SetBar(0f, maxHp);

            Destroy(gameObject);
        }
        else
        {
            hpBar.SetBar(HP, maxHp);
        }
    }
Exemplo n.º 2
0
    public void TakeDamage(int demage)
    {
        if (HP <= 0)
        {
            return;
        }
        HP -= demage;

        if (HP <= 0)
        {
            hpBar.SetBar(0f, maxHp);
            PowerupSpawner PowerupSpawner_Instance = gameObject.GetComponent <PowerupSpawner>();
            PowerupSpawner_Instance.Spawn();
            Destroy(gameObject);
        }
        else
        {
            hpBar.SetBar(HP, maxHp);
        }
    }