// Detects the raptors inside the vision cone private void detectEnemies() { RaycastHit[] coneHits = MyPhysics.ConeCastAll(obj.transform.position, radius, obj.transform.forward, depth, angle); if (coneHits.Length > 0) { for (int i = 0; i < coneHits.Length; i++) { if (coneHits[i].collider.CompareTag("Predator")) { coneHits[i].collider.gameObject.GetComponent <Renderer>().material.color = new Color(0, 0, 1f); // Notify everyone of the danger! foreach (GameObject suricate in GameObject.FindGameObjectsWithTag("Suricate")) { suricate.SendMessage("ToSafety"); } } if (coneHits[i].collider.CompareTag("Wall")) { coneHits[i].collider.gameObject.GetComponent <Renderer>().material.color = new Color(0, 0, 1f); } } } }