Пример #1
0
 public void StartGame(int players)
 {
     Board.Generate();
     this.Players       = players;
     this.CurrentPlayer = 1;
     this.Turn          = 1;
     this.UIState       = new UnselectedState();
 }
Пример #2
0
 public void Enter(IUIState state)
 {
     for (int i = 0; i < States.Length; i++)
     {
         if (States[i] == state)
         {
             currentState = i;
         }
     }
 }
Пример #3
0
        public void Update()
        {
            prevMouseState = mouseState;
            mouseState     = Mouse.GetState();

            IUIState newState = UIState.HandleInput(mouseState, prevMouseState, CurrentPlayer);

            if (Board.PlayerTurnEnded)
            {
                NextPlayerTurn();
                Board.PlayerTurnEnded = false;
            }

            if (newState != null)
            {
                UIState.OnLeave();
                UIState = newState;
                UIState.OnEnter();
            }
        }
Пример #4
0
 void Awake()
 {
     mainGame = MainGame.Instance; //this starts the MainGame script
     UIMM = new UIMainMenu(this);
     UISP = new UISetPiece (this);
     UIHUD = new UIGameHUD(this, mainGame);
     UISOG = new UIShotState(this);
     UIState = UIMM;
 }
Пример #5
0
        public void EnterState(IUIState uiState, Interactions.BaseInteraction io)
        {
            if (uiState == null)
            {
                throw new ArgumentNullException("uiState");
            }
            else if (UIState != null)
            {
                throw new InvalidOperationException("Can't enter a state before leaving the previous state.");
            }

            UIState = uiState;
            uiState.OnEnter(io);
        }