public void StartGame(int players) { Board.Generate(); this.Players = players; this.CurrentPlayer = 1; this.Turn = 1; this.UIState = new UnselectedState(); }
public void Enter(IUIState state) { for (int i = 0; i < States.Length; i++) { if (States[i] == state) { currentState = i; } } }
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(); } }
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; }
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); }