Пример #1
0
 void Update()
 {
     if (!EventSystem.current.IsPointerOverGameObject())
     {
         if (Input.GetMouseButton(0))
         {
             HandleInput();
             return;
         }
         if (Input.GetKeyDown(KeyCode.U))
         {
             if (Input.GetKey(KeyCode.LeftShift))
             {
                 DestroyUnit();
             }
             else
             {
                 spawnUnit = units[0];
                 CreateUnit();
             }
             return;
         }
         else if (Input.GetKeyDown(KeyCode.I))
         {
             if (Input.GetKey(KeyCode.LeftShift))
             {
                 DestroyUnit();
             }
             else
             {
                 spawnUnit = units[1];
                 CreateUnit();
             }
             return;
         }
         else if (Input.GetKeyDown(KeyCode.O))
         {
             if (Input.GetKey(KeyCode.LeftShift))
             {
                 DestroyUnit();
             }
             else
             {
                 spawnUnit = units[2];
                 CreateUnit();
             }
             return;
         }
         else if (Input.GetKeyDown(KeyCode.P))
         {
             if (Input.GetKey(KeyCode.LeftShift))
             {
                 DestroyUnit();
             }
             else
             {
                 spawnUnit = units[3];
                 CreateUnit();
             }
             return;
         }
     }
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (optMenu.gameObject.activeInHierarchy)
         {
             optMenu.Close();
         }
         else
         {
             optMenu.Open();
         }
     }
     previousCell = null;
 }
Пример #2
0
 private void BtnBack_Click(object sender, RoutedEventArgs e)
 {
     _parent.Show();
     _view.Close();
 }
Пример #3
0
 internal void BackToStartScreen()
 {
     OptionsMenu.Close();
 }
Пример #4
0
    void Update()
    {
        if (!EventSystem.current.IsPointerOverGameObject())
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                UpdateCurrentCell();
                HexMapCamera.instance.Focus(currentCell);
            }
            if (Input.GetMouseButtonDown(0))
            {
                if (selectedUnit && isMoving)
                {
                    DoMove();
                }
                else if (selectedUnit && isAttacking)
                {
                    DoAttack();
                }
                else
                {
                    DoSelection();
                }
            }
            else if (selectedUnit)
            {
                if (isMoving)
                {
                    DoPathfinding();
                }
            }
        }

        if (Input.GetKeyUp(KeyCode.C))
        {
            RotatePrev();
        }
        else if (Input.GetKeyUp(KeyCode.Z))
        {
            RotateNext();
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (optMenu.gameObject.activeInHierarchy)
            {
                optMenu.Close();
            }
            else
            {
                optMenu.Open();
            }
        }

        if (GameManager.instance.currentTeamIndex > 0)
        {
            endTurnButton.gameObject.SetActive(false);
        }
        else
        {
            endTurnButton.gameObject.SetActive(true);
        }
    }