public void TomarDano() { vida--; if (instantiateOnDamage != null) { Instantiate(instantiateOnDamage, transform.position + new Vector3(Random.Range(-0.2f, 0.2f), Random.Range(-0.2f, 0.2f)), Quaternion.identity); } if (vida <= 0) { Atracao temp = GetComponentInParent <Atracao>(); if (transform.parent.gameObject == Parque.GetParque().gameObject) { GameManager.GetGameManager().SomarScore(300); } print(transform.parent); if (temp != null) { temp.DesastreEliminado(gameObject); } } }
// Start is called before the first frame update void Start() { Destroy(gameObject, Random.Range(minimumCrowdDuration, maximumCrowdDuration)); parque = Parque.GetParque(); }