예제 #1
0
    private void OnMouseDown()
    {
        if (EventSystem.current.IsPointerOverGameObject())
            return;

        if (RectTransformExtensions.IsPointerOverUIObject())
            return;

        UIManager.Instance.TowerToWork = this;
        UIManager.Instance.ShowUpdatePanel();
    }
예제 #2
0
    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;
    }