Esempio n. 1
0
        // Update is called once per frame
        void Update()
        {
            if (!isOn)
            {
                return;
            }

            Vector3 screenPos = Camera.main.WorldToScreenPoint(currentTower.thisT.position);

            floatingButtons.transform.localPosition = screenPos / UI.GetScaleFactor();

            //force the frame to go left when the tower is off screen (specifically for dragNdrop button hover)
            if (currentTower.IsSampleTower())
            {
                if (screenPos.x < 0 || screenPos.x > Screen.width || screenPos.y < 0 || screenPos.y > Screen.height)
                {
                    screenPos.x = Screen.width;
                    currentX    = 0;
                }
            }

            if (currentX < Screen.width / 2 && screenPos.x > Screen.width / 2)
            {
                _SetScreenPos(screenPos);
            }
            else if (currentX > Screen.width / 2 && screenPos.x < Screen.width / 2)
            {
                _SetScreenPos(screenPos);
            }
        }