示例#1
0
 public void PressEscape()
 {
     if (playable)
     {
         if (!GameUI.Instance.inGameMenu)
         {
             if (GameUI.Instance.inActionMenu)
             {
                 GameUI.Instance.CloseActionMenu();
             }
             else
             {
                 GameUI.Instance.CallGameMenu();
             }
         }
         else if (moveSelectionPhase || attackSelectionPhase)
         {
             moveSelectionPhase   = false;
             attackSelectionPhase = false;
             selectedOne          = null;
         }
         else
         {
             GameUI.Instance.CloseGameMenu();
         }
     }
 }
示例#2
0
    private void Attack()
    {
        GameUI.Instance.CloseActionMenu();
        selectedOne = UnitManager.Instance.Selected(MapManager.Instance.GetCursorPos());

        attackSelectionPhase = true;
    }
示例#3
0
 private void BeginNewTurn()
 {
     playerOnePhase   = true;
     selectedOne      = null;
     selectedBuilding = null;
     Turn++;
     GameUI.Instance.SendPopUp("Player 1\r\nTurn " + Turn);
     TimerManager.Instance.AddTimer(this, closePopUpTimer);
     moneyPlayer1 += BuildingManager.Instance.BeginOfPhase(playerOnePhase) * 500;
     GameUI.Instance.UpdateMoney(moneyPlayer1);
 }
示例#4
0
    public void PressSpace()
    {
        Vector3    cursorPos = MapManager.Instance.GetCursorPos();
        Vector3Int pos       = new Vector3Int((int)cursorPos.x, (int)cursorPos.y, 0);

        if (playable)
        {
            if (!GameUI.Instance.inGameMenu && !GameUI.Instance.inActionMenu && !moveSelectionPhase && !attackSelectionPhase)
            {
                selectedOne      = UnitManager.Instance.Selected(pos);
                selectedBuilding = BuildingManager.Instance.Selected(pos);


                if (selectedOne != null)
                {
                    if (selectedOne.team == playerOnePhase)
                    {
                        List <Option> unitActions = new List <Option>();
                        if (selectedOne.CanMove)
                        {
                            unitActions.Add(move);
                        }
                        if (selectedOne.CanAct)
                        {
                            unitActions.Add(attack);
                            if (selectedBuilding != null)
                            {
                                if (selectedBuilding.team != playerOnePhase)
                                {
                                    unitActions.Add(capture);
                                }
                            }
                        }

                        if (unitActions.Count > 0)
                        {
                            GameUI.Instance.CallActionMenu(unitActions);
                        }
                    }
                }
                else if (selectedBuilding != null)
                {
                    if (selectedBuilding.nature == false && selectedBuilding.team == playerOnePhase)
                    {
                        LaunchStoreMenu();
                    }
                }
            }
            else if (moveSelectionPhase)
            {
                moveSelectionPhase = false;
                selectedOne.Move(cursorPos);
            }
            else if (attackSelectionPhase)
            {
                attackSelectionPhase = false;
                selectedOne.Attack(UnitManager.Instance.Selected(cursorPos));
            }
            else
            {
                GameUI.Instance.PressSpace();
            }
        }
    }