public GridBuilder WithSquareStatus(GridCoordinate coordinate, GridSquareStatus status) { var squareBuilder = _squareBuilders[coordinate.Row, coordinate.Column]; squareBuilder.WithStatus(status); return(this); }
public GridSquareArrayBuilder WithStatus(GridSquareStatus status) { for (int i = 0; i < _gridSquareMocks.Length; i++) { _gridSquareMocks[i] = new GridSquareBuilder().WithStatus(status).BuildMock(); } return this; }
public GridSquareBuilder WithStatus(GridSquareStatus status) { _gridSquareMock.SetupGet(s => s.Status).Returns(status); if (status != GridSquareStatus.Untouched) { _gridSquareMock.SetupGet(s => s.NumberOfBombs).Returns(1); } return(this); }
public GridBuilder WithAllSquaresWithStatus(GridSquareStatus status) { for (int i = 0; i < _size; i++) { for (int j = 0; j < _size; j++) { var squareBuilder = _squareBuilders[i, j]; squareBuilder.WithStatus(status); } } return(this); }
public CADGridSquare() { image = Resources.Load <Sprite>("square"); status = GridSquareStatus.Available; }
private List <GridCoordinate> GetNeighbours(GridCoordinate coordinate, Direction[] possibleDirections, GridSquareStatus withStatus) { List <GridCoordinate> result = new List <GridCoordinate>(); foreach (Direction direction in possibleDirections) { GridCoordinate otherCoordinate = coordinate.GetNeighbor(direction); if (!otherCoordinate.IsOutOfBounds(this.opponentGrid.Size)) { IGridSquare otherSquare = this.opponentGrid.GetSquareAt(otherCoordinate); if (otherSquare.Status == withStatus) { result.Add(otherCoordinate); } } } return(result); }
protected virtual void Miss() { Status = GridSquareStatus.MISS; }
protected virtual void Hit() { Status = GridSquareStatus.HIT; OnChanged(EventArgs.Empty); }
public ShipBuilder WithSquares(GridSquareStatus status = GridSquareStatus.Untouched) { _shipMock.SetupGet(s => s.Squares).Returns(new GridSquareArrayBuilder(_kind).WithStatus(status).BuildArray()); return(this); }