void OnTriggerEnter(Collider coll) { PointsPickup pu = coll.GetComponent <PointsPickup> (); if (pu != null) { GameObject.Destroy(pu.gameObject); _pointsHUD.AddPoints(pu.points); } }
void SpawnPointsPickup() { GameObject newPickup = pointsPooler.GetPooledObject(); if (newPickup != null) { PointsPickup newPickupScript = newPickup.GetComponent <PointsPickup>(); newPickupScript.gameControllerInstance = this.gameObject; newPickupScript.points = Random.Range(1, 5); newPickupScript.position = new Vector3(Random.Range(-4f, 4f), Random.Range(-1.5f, 1.5f), 0f); newPickup.SetActive(true); } }