Ejemplo n.º 1
0
    public void TakeDamage(int dmg)
    {
        curr_health -= dmg;
        float tempcur = curr_health;
        float tempmax = max_health;

        HpBar.value = tempcur / tempmax;
        GameObject DamageTextInstance = Instantiate(damageTextPrefab, this.transform.position, Quaternion.identity, this.transform);

        DamageTextInstance.transform.GetChild(0).GetComponent <TextMeshPro>().SetText(dmg.ToString());
        if (curr_health <= 0)
        {
            Destroy(this.gameObject);
            if (currlevel == 0)
            {
                gm.TutorialLevel();
            }
            else if (currlevel == 1)
            {
                gm.JaneLevel();
            }
            else
            {
                gm.AbbyLevel();
            }
        }
    }