Exemple #1
0
    public void OnLaserHit(int damage)
    {
        if (hpScript.GetHP() > 0)
        {
            hpScript.Decrease(damage);

            if (hpScript.GetHP() == 0)
            {
                GameObject explosion = (GameObject)Instantiate(explosionPrefab);
                explosion.transform.position = transform.position;

                Destroy(gameObject);
            }
        }
    }