// change the current player private void changeActivePlayer() { int currentPlayer = PlayerTurnController.changeActivePlayer(); var playerTurnViewScript = playerTurnView.GetComponent <PlayerTurnView>(); playerTurnViewScript.updateActivePlayerText(currentPlayer); }
public GameStateController(GameState <T> gameState, IList <IPlayer> players) { //shuffle before assigning round order players.Shuffle(); PlayerTurnController = new PlayerTurnController(); PlayerTurnController.AddPlayers(players); gameState.OnStateUpdated += OnStateUpdated; GameState = gameState; }
public void ShouldGiveMultipleTurnsPerPlayer() { _playerTurnController = new PlayerTurnController(2); AddBasePlayers(); var endRoundCalled = false; _playerTurnController.OnRoundFinished += (sender, args) => endRoundCalled = true; _playerTurnController.EndTurn(_player1); _playerTurnController.EndTurn(_player2); _playerTurnController.EndTurn(_player3); Assert.IsFalse(endRoundCalled); _playerTurnController.EndTurn(_player1); _playerTurnController.EndTurn(_player2); _playerTurnController.EndTurn(_player3); Assert.IsTrue(endRoundCalled); }
// Unity lifecycle method void Start() { // reset the PlayerTurnController, this is only helpful when a game gets reset or restarted PlayerTurnController.init(); PlayerScoreController.startNewGame(); masterGameTimeText = GameObject.FindGameObjectWithTag("masterGameTime").gameObject; elapsedTurnTimeText = GameObject.FindGameObjectWithTag("elapsedTurnTime").gameObject; winnerBannerText = GameObject.FindGameObjectWithTag("winnerBanner").gameObject; playerTurnView = GameObject.FindGameObjectWithTag("playerTurnView").gameObject; undoLastMoveButtonController = GameObject.FindGameObjectWithTag("undoLastMoveButtonController").gameObject; undoLastMoveButtonControllerScript = undoLastMoveButtonController.GetComponent <UndoLastMoveButtonController>(); playerOneScoreView = GameObject.FindGameObjectWithTag("playerOneScoreView").gameObject; playerTwoScoreView = GameObject.FindGameObjectWithTag("playerTwoScoreView").gameObject; // FIXME: move this to a view class playerOneScoreView.GetComponent <Text>().text = "0"; playerTwoScoreView.GetComponent <Text>().text = "0"; winnerBannerText.GetComponent <Text>().text = ""; currentGameTime = 0f; didStart = true; resetTurnTime(); }
public void SetUp() { _playerTurnController = new PlayerTurnController(); _playerTurnController.ClockwiseTurns = false; AddBasePlayers(); }
public PlayerTurnState(BattleManager battleManager, PlayerTurnController turnController) : base(battleManager) { _controller = turnController; }
public void ShouldFailIfTurnsPerPlayerIsZero() { Assert.Throws <InvalidTurnsPerPlayerException>(() => _playerTurnController = new PlayerTurnController(0)); }
public void SetUp() { _playerTurnController = new PlayerTurnController(); AddBasePlayers(); }