public void TestIsOverlappingWithCache_WhenNotClose_ShouldNotHitCache() { var tileLocator = new TileLocator(); tileLocator.IsOverlapping(new Position(50, 50), 1, 1, new Position(50, 47), 1, 0); tileLocator.OverlappingCache.Should().HaveCount(0); }
public void ForeachMultiple_WhenXIsEvenAndYIsOddAndSizeIs2(TileLocator tileLocator) { tileLocator.ForeachMultitile(48, 47, 2).Should().HaveCount(4). And.Contain(new[] { new Position(48, 47), new Position(49, 46), new Position(49, 47), new Position(49, 48) } ); }
public void ForeachMultiple_WhenXAndYAreEvenAndSizeIs2(TileLocator tileLocator) { var positions = tileLocator.ForeachMultitile(50, 46, 2); positions.Should().HaveCount(4). And.Contain(new[] { new Position(50, 46), new Position(50, 45), new Position(51, 46), new Position(50, 47) }); }
public void RadiusDistance_WithObj_ShouldReturnLowestRadiusDistanceBetweenObjTiles( int x, int y, int size, int x1, int y1, int size1, int expected, ISimpleGameObject obj1, ISimpleGameObject obj2, TileLocator tileLocator ) { obj1.PrimaryPosition.Returns(new Position((uint)x, (uint)y)); obj1.Size.Returns((byte)size); obj2.PrimaryPosition.Returns(new Position((uint)x1, (uint)y1)); obj2.Size.Returns((byte)size1); tileLocator.RadiusDistance(obj1, obj2).Should().Be(expected); }
public void ForeachMultiple_WhenXIsEvenAndYIsEvenAndSizeIs3(TileLocator tileLocator) { tileLocator.ForeachMultitile(50, 46, 3).Should().HaveCount(9). And.Contain(new[] { new Position(50, 46), new Position(50, 45), new Position(51, 44), new Position(50, 47), new Position(51, 46), new Position(51, 45), new Position(51, 48), new Position(51, 47), new Position(52, 46), } ); }
public CityResourceTileGenerator(TileLocator tileLocator, Formula formula) { this.tileLocator = tileLocator; this.formula = formula; }
public void ForeachMultiple_WhenYIsOddAndSizeIs1(TileLocator tileLocator) { tileLocator.ForeachMultitile(0, 1, 1).Should().Equal(new Position(0, 1)); }
public void TestIsOverlapping_WithSize_ShouldOverlap(int x1, int y1, int size1, int r1, int x2, int y2, int size2, int r2, bool expected, TileLocator tileLocator) { var isOverlapping = tileLocator.IsOverlapping(new Position((uint)x1, (uint)y1), (byte)size1, (byte)r1, new Position((uint)x2, (uint)y2), (byte)size2, (byte)r2); isOverlapping.Should().Be(expected); }