Ejemplo n.º 1
0
    private void hurtMe(int damage, Collision2D collision)
    {
        int d = damage / (shieldUp ? 2 : 1);

        damageInflicting += d;
        damageText.text   = damageInflicting.ToString();
        StartCoroutine(UpdateDamageTextSize());
        hitPoints -= d;
        commonProc.updateText(hitPoints.ToString()); //not working
        Destroy(collision.gameObject);
        if (hitPoints <= 0)
        {
            GameObject ex = Instantiate(explosion, collision.collider.transform.position, collision.collider.transform.rotation);
            Destroy(ex, 1);
            Destroy(gameObject);
        }
    }