Beispiel #1
0
        // Update is called once per frame
        void Update()
        {
            if (GameControl.GetGameState() == _GameState.Over)
            {
                return;
            }

            if (UIUtilities.IsCursorOnUI())
            {
                return;
            }

            if (!UseDragNDrop() && !UIBuildButton.isOn)
            {
                BuildManager.SetIndicator(Input.mousePosition);
            }

            if (Input.GetMouseButtonDown(0))
            {
                UnitTower tower = GameControl.Select(Input.mousePosition);

                if (tower != null)
                {
                    SelectTower(tower);
                    UIBuildButton.Hide();
                }
                else
                {
                    if (selectedTower != null)
                    {
                        ClearSelectedTower();
                        return;
                    }

                    if (!UseDragNDrop())
                    {
                        if (BuildManager.CheckBuildPoint(Input.mousePosition) == _TileStatus.Available)
                        {
                            UIBuildButton.Show();
                        }
                        else
                        {
                            UIBuildButton.Hide();
                        }
                    }
                }
            }
        }
Beispiel #2
0
        void UpdateMouse()
        {
            if (UIUtilities.IsCursorOnUI())
            {
                return;
            }

            if (!UseDragNDrop() && !UIBuildButton.isOn)
            {
                BuildManager.SetIndicator(Input.mousePosition);
            }

            if (Input.GetMouseButtonDown(0))
            {
                OnTouchCursorDown(Input.mousePosition);
            }
        }
Beispiel #3
0
        // Update is called once per frame
        void Update()
        {
            if (GameControl.GetGameState() == _GameState.Over)
            {
                return;
            }

            if (FPSControl.IsOn())
            {
                return;
            }

            if (abilityTargetSelecting)
            {
                return;
            }

                        #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8
            if (Input.touchCount == 1)
            {
                Touch touch = Input.touches[0];

                if (UIUtilities.IsCursorOnUI(touch.fingerId))
                {
                    return;
                }

                if (!UseDragNDrop() && !UIBuildButton.isOn)
                {
                    BuildManager.SetIndicator(touch.position);
                }

                if (touch.phase == TouchPhase.Began)
                {
                    OnTouchCursorDown(touch.position);
                }
            }
            else
            {
                UpdateMouse();
            }
                        #else
            UpdateMouse();
                        #endif
        }