Ejemplo n.º 1
0
        void OnCursorDown(Vector3 cursorPos)
        {
            UnitTower tower = GameControl.Select(cursorPos);

            GameControl.SelectTower(tower);

            if (tower != null)
            {
                if (!BuildManager.UseDragNDrop())
                {
                    UIBuildButton.Hide();
                }
                if (autoCenterCamera)
                {
                    CameraControl.SetPosition(tower.thisT.position);
                }

                UITowerView.Show(tower);
            }
            else
            {
                UITowerView.Hide();

                if (!BuildManager.UseDragNDrop())
                {
                    BuildInfo buildInfo = BuildManager.CheckBuildPoint(cursorPos);
                    UIBuildButton.Show(buildInfo);
                    if (buildInfo.status == _TileStatus.Available && autoCenterCamera)
                    {
                        CameraControl.SetPosition(buildInfo.position);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                if (BuildManager.UseDragNDrop() && BuildManager.InDragNDrop())
                {
                    return;
                }
                if (!UITowerView.IsOn() && !AbilityManager.IsSelectingTarget() && !UIPerkMenu.IsOn() && !UIFPS.IsOn())
                {
                    TogglePause();
                }
            }

            //keyboard for cursor based input start here
            if (!enableInput)
            {
                return;
            }

            if (Input.touchCount > 1)
            {
                return;
            }
            if (UI.IsCursorOnUI(0) || UI.IsCursorOnUI())
            {
                return;
            }

            if (Input.GetMouseButtonDown(0))
            {
                OnCursorDown(Input.mousePosition);
            }
        }
Ejemplo n.º 3
0
        void Start()
        {
            if (limitScale)
            {
                for (int i = 0; i < scalerList.Count; i++)
                {
                    if (Screen.width >= scalerList[i].referenceResolution.x)
                    {
                        instance.scalerList[i].uiScaleMode = CanvasScaler.ScaleMode.ConstantPixelSize;
                    }
                    else
                    {
                        instance.scalerList[i].uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
                    }
                }
            }

            if (perkMenuOnly)
            {
                UIHUD.GetInstance().gameObject.SetActive(false);
                UIBuildButton.GetInstance().gameObject.SetActive(false);
                UIAbilityButton.GetInstance().gameObject.SetActive(false);
                UITowerView.GetInstance().gameObject.SetActive(false);

                UIPerkMenu.DisableCloseButton();
                OnPerkMenu();
            }
        }
Ejemplo n.º 4
0
        public void _OnPerkMenu()
        {
            UITowerView.Hide();

            CameraControl.FadeBlur(uiBlurEffect, 0, 2);
            CameraControl.TurnBlurOn();
            GameControl.PauseGame();
            UIPerkMenu.Show();

            Time.timeScale = 0;
        }
Ejemplo n.º 5
0
        //public RectTransform buttonParent;
        //private Vector3 buttonParentDefaultPos;

        void Awake()
        {
            instance    = this;
            thisT       = transform;
            thisObj     = gameObject;
            canvasGroup = thisObj.GetComponent <CanvasGroup>();
            if (canvasGroup == null)
            {
                canvasGroup = thisObj.AddComponent <CanvasGroup>();
            }

            canvasGroup.alpha   = 0;
            thisT.localPosition = new Vector3(0, 9999, 0);

            butUpgrade1Canvas = butUpgradeObj1.GetComponent <CanvasGroup>();
            butUpgrade2Canvas = butUpgradeObj2.GetComponent <CanvasGroup>();
        }
Ejemplo n.º 6
0
 public static void ClearSelectedTower()                 //for CameraControl to clear tower when panning the camera (using touch control)
 {
     GameControl.SelectTower();
     UITowerView.Hide();
 }