void MouseOver_Unit(GameObject ourHitObject) { //Debug.Log("Raycast hit: " + ourHitObject.name ); if (Input.GetMouseButtonDown(0) && ourHitObject.GetComponentInParent <AirplanBase>().getCountry() == 1) { // We have click on the unit selectedUnit = ourHitObject.GetComponentInParent <AirplanBase>(); selectedTown = null; gameController.setChoosen(selectedUnit, selectedTown); } if (Input.GetMouseButtonDown(0) && ourHitObject.GetComponentInParent <AirplanBase>().getCountry() != 1 && selectedTown != null) { // We have click on the unit selectedTown.Attack(ourHitObject.GetComponentInParent <AirplanBase>()); } if (Input.GetMouseButtonDown(0) && ourHitObject.GetComponentInParent <AirplanBase>().getCountry() != 1 && selectedUnit != null) { // We have click on the unit selectedUnit.Attack(ourHitObject.GetComponentInParent <AirplanBase>()); } }