/// <summary> /// /// </summary> void SelectSquad() { ray = Camera.main.ScreenPointToRay(Input.mousePosition); //Debug.DrawRay(ray.origin, ray.direction * 50.0f, Color.green); if (Physics.Raycast(ray, out hit, 50.0f)) { if (hit.collider.gameObject.tag == "Unit") { squadObject = hit.collider.gameObject.GetComponent <Squad>(); squadSelected = true; if (squadObject.GetComponent <Squad>().origin == null) { squadObject.GetComponent <Squad>().origin = headQuarters.GetComponent <CityNode>(); } } if (hit.collider.gameObject.tag == "City") { squadSelected = false; } } else { squadSelected = false; } }