private void OnMouseDown() { if (EventSystem.current.IsPointerOverGameObject()) return; if (RectTransformExtensions.IsPointerOverUIObject()) return; UIManager.Instance.TowerToWork = this; UIManager.Instance.ShowUpdatePanel(); }
private void OnMouseDown() { if (EventSystem.current.IsPointerOverGameObject()) { return; } if (RectTransformExtensions.IsPointerOverUIObject()) { return; } towerWindow.SetActive(true); Vector2 screenPoint = cam.ScreenToWorldPoint(Input.mousePosition); Vector2 roundMousePos = new Vector2(Mathf.RoundToInt(screenPoint.x), Mathf.RoundToInt(screenPoint.y)); Vector2 pointToMove = cam.WorldToScreenPoint(roundMousePos); windowRectTransform.position = pointToMove; RectTransformExtensions.CheckScreenPosition(towerWindow, windowScreenBound.x, windowScreenBound.y); towerWindow.GetComponent <TowerSpawner>().spawnPos = roundMousePos; }