void CheckForItems(float dist, Vector3 pos) { GameObject[] gos; gos = GameObject.FindGameObjectsWithTag("item"); foreach (GameObject go in gos) { xa.glx = go.transform.position; xa.glx.z = pos.z; if (Vector3.Distance(xa.glx, pos) < 10) //just check theyre not, like, on the other side of the map { float tempDist = dist; ItemScript itemScript = go.GetComponent <ItemScript>(); if (itemScript != null) { if (itemScript.itemActivationRadiusOverride != -1) { tempDist = itemScript.itemActivationRadiusOverride; } } if (Vector3.Distance(xa.glx, pos) < tempDist) { if (itemScript != null && itemScript.type != "bounceCoin") { UseFoundItem(go); } if (itemScript != null && itemScript.type == "bouncePad") { UseFoundItem(go); } } } } ShrineScript.CheckShrines(pos); }
private void Awake() { shrine = GetComponentInParent <ShrineScript>(); }