void OnMouseOver() { if (Input.GetMouseButtonUp(0)) { GeneralUnitsController.CleanSelections(); SendMessage("OnSelect"); UnitInfoPanel.Instance.ShowUnitInfo(this); } if (Input.GetMouseButtonUp(1)) { GeneralUnitsController.Attack(this); } }
void Update() { if (Input.GetMouseButtonUp(0) && GeneralUnitsController.Selection.width > 0 && GeneralUnitsController.Selection.height > 0) { Vector3 camPos = Camera.main.WorldToScreenPoint(transform.position); camPos.y = GeneralUnitsController.ScreenToRectY(camPos.y); IsSelected = GeneralUnitsController.Selection.Contains(camPos); if (IsSelected) { SendMessage("OnSelect"); } else { SendMessage("OnUnselect"); } } }
void Awake() { Instance = this; }