Exemple #1
0
        public void ShouldCountFreezeStops_WhenPassAndStop(
            int dice,
            int expectedPosition,
            int freezeOnStopCountExpected,
            int freezeOnPassCountExpected
            )
        {
            //Arrange
            _playerCursorMock.
            Setup(_ => _.Next()).
            Returns(_player1.Move(dice));

            var boardCursor = new BoardCursor(
                _fivePlacesWithFreezeBoard,
                _playerCursorMock.Object);

            _freezeEntry.OnPass += FreezeOnPass;
            _freezeEntry.OnStop += FreezeOnStop;

            //Act
            boardCursor.NextTurn();

            //Assert
            boardCursor.Positions[_player1].Should().Be(expectedPosition);
            _freezeOnStopExecuted.Should().Be(freezeOnStopCountExpected);
            _freezeOnPassExecuted.Should().Be(freezeOnPassCountExpected);
        }
Exemple #2
0
        public void ShouldMoveTwoPlayers(int dice, int position)
        {
            //Arrange
            _playerCursorMock.
            SetupSequence(_ => _.Next()).
            Returns(_player1.Move(dice)).
            Returns(_player2.Move(dice));

            var boardCursor = new BoardCursor(
                _fivePlacesWithFreezeBoard,
                _playerCursorMock.Object);

            _freeStop.OnStop    += FreeOnStop;
            _freeStop.OnPass    += FreeOnPass;
            _freezeEntry.OnStop += FreeOnStop;
            _freezeEntry.OnPass += FreeOnPass;

            //Act
            boardCursor.NextTurn();
            boardCursor.NextTurn();

            //Assert
            boardCursor.Positions[_player1].Should().Be(position);
            boardCursor.Positions[_player2].Should().Be(position);
            _freeOnStopExecuted.Should().Be(2);
            _freeOnPassExecuted.Should().Be((dice - 1) * 2);
        }
        public void ShouldFreeze_WhenThereIsAFreezeStop()
        {
            //Arrange
            _playerCursorMock.
            Setup(_ => _.Next()).
            Returns(_player1.Freeze);

            var boardCursor = new BoardCursor(
                _fivePlacesWithFreezeBoard,
                _playerCursorMock.Object);

            //Act
            boardCursor.NextTurn();

            //Assert
            boardCursor.Positions[_player1].Should().Be(3);
        }
        public void ShouldMovePlayerOnBoard(int totalDice, int destinationIndex)
        {
            //Arrange
            _playerCursorMock.
            Setup(_ => _.Next()).
            Returns(_player1.Move(totalDice));

            var boardCursor = new BoardCursor(
                _fivePlacesBoard,
                _playerCursorMock.Object);

            //Act
            boardCursor.NextTurn();

            //Assert
            boardCursor.Positions[_player1].Should().Be(destinationIndex);
        }
    private void Start()
    {
        _pawnChild = transform.FindChild(_PAWN_CHILD_NAME);
        _gridFieldChild = transform.FindChild(_GRID_FIELD_CHILD);

        Cursor = GetComponentInChildren<BoardCursor>();

        if (CombatantViewPrefab == null) {
            throw new NullReferenceException("CombatantViewPrefab was not set");
        }
    }
Exemple #6
0
 // Start is called before the first frame update
 void Start()
 {
     coll   = GetComponent <Collider2D> ();
     cursor = this;
 }
 // Use this for initialization
 void Awake()
 {
     _cursor = GetComponent<BoardCursor>();
 }