Exemplo n.º 1
0
    // change the current player
    private void changeActivePlayer()
    {
        int currentPlayer = PlayerTurnController.changeActivePlayer();

        var playerTurnViewScript = playerTurnView.GetComponent <PlayerTurnView>();

        playerTurnViewScript.updateActivePlayerText(currentPlayer);
    }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
    // 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();
    }
Exemplo n.º 5
0
 public void SetUp()
 {
     _playerTurnController = new PlayerTurnController();
     _playerTurnController.ClockwiseTurns = false;
     AddBasePlayers();
 }
Exemplo n.º 6
0
 public PlayerTurnState(BattleManager battleManager, PlayerTurnController turnController) : base(battleManager)
 {
     _controller = turnController;
 }
Exemplo n.º 7
0
 public void ShouldFailIfTurnsPerPlayerIsZero()
 {
     Assert.Throws <InvalidTurnsPerPlayerException>(() => _playerTurnController = new PlayerTurnController(0));
 }
Exemplo n.º 8
0
 public void SetUp()
 {
     _playerTurnController = new PlayerTurnController();
     AddBasePlayers();
 }