public void deselect_active_unit() { if (selected_unit_List.Contains(active_unit)) { selected_unit_List.Remove(active_unit); } if (active_unit != null) { active_unit.setDeselected(); } active_unit = null; }
//при нажатии на правую кнопку мыши снимаем выделение с юнитов: public void deselect_all_units() { //Отключаем активные здания: if (Input.GetMouseButtonDown(1)) { //Если мы были в казарме: if (GameManager.Instance.ui == GameManager.ui_type.distance_kazarm || GameManager.Instance.ui == GameManager.ui_type.melee_kazarm) { GameManager.Instance.disable_ui(); GameManager.Instance.ui = GameManager.ui_type.empty; } } if (GameManager.Instance.selected_unit_List.Count > 1) { if (Input.GetMouseButtonDown(1)) { if (GameManager.Instance.active_unit != null) { GameManager.Instance.active_unit = null; } for (int i = 0; i < GameManager.Instance.selected_unit_List.Count; i++) { Movement_Units next = GameManager.Instance.selected_unit_List [i]; next.setDeselected(); } GameManager.Instance.selected_unit_List.Clear(); } } else { if (Input.GetMouseButtonDown(1)) { GameManager.Instance.deselect_active_unit(); } } }