public void CopyConstructorClonesFeatureMap() { var f1 = new AtlasWarriorsGame.DungeonGenerators.Feature(10, 10); var f2 = new AtlasWarriorsGame.DungeonGenerators.Feature(f1); Assert.AreNotSame(f1.GetCell(new XY(5, 5)), f2.GetCell(new XY(5, 5))); }
public void WidthHeight(int W, int H) { var f = new AtlasWarriorsGame.DungeonGenerators.Feature(W, H); Assert.AreEqual(W, f.Width); Assert.AreEqual(H, f.Height); }
public void CopyConstructorCreatesNewPossibleDoors() { var f2 = new AtlasWarriorsGame.DungeonGenerators.Feature(Feature); Feature.AddPossibleDoor(new XY(6, 2)); Assert.IsFalse(f2.PossibleDoors.Contains(new XY(6, 2)), "PossibleDoors lists weren't copied and share a reference"); }
public void CopyConstructorCopiesPossibleDoors() { Feature.AddPossibleDoor(new XY(4, 1)); Feature.AddPossibleDoor(new XY(6, 2)); var f2 = new AtlasWarriorsGame.DungeonGenerators.Feature(Feature); Assert.IsTrue(f2.PossibleDoors.Contains(new XY(4, 1))); Assert.IsTrue(f2.PossibleDoors.Contains(new XY(6, 2))); }
public void CopyConstructorCopiesMap(XY Coord, DungeonCell Value) { var f1 = new AtlasWarriorsGame.DungeonGenerators.Feature(4, 4); f1.SetCell(Coord, Value); var f2 = new AtlasWarriorsGame.DungeonGenerators.Feature(f1); Assert.AreEqual(Value, f2.GetCell(Coord)); }
public void SpawnArea() { // Build an empty room Feature = AtlasWarriorsGame.DungeonGenerators.RoomsGenerator.CreateFeature(5, 10); // Test all correct for (int ix = 1; ix < (Feature.Width - 1); ++ix) { for (int iy = 1; iy < (Feature.Height - 1); ++iy) { Assert.IsTrue(Feature.SpawnArea.Area.Contains(new XY(ix, iy)), $"Part of spawn area new found at {ix}, {iy}"); } } }
public void Rotate() { // Define initial one var f1 = new AtlasWarriorsGame.DungeonGenerators.Feature(3, 4); f1.SetCell(new XY(0, 0), DungeonCell.Wall); f1.SetCell(new XY(0, 1), DungeonCell.Door); f1.SetCell(new XY(1, 2), DungeonCell.Wall); f1.SetCell(new XY(2, 3), DungeonCell.Door); // Test up var fUp = f1.Rotate(AtlasWarriorsGame.DungeonGenerators.Feature.Rotation.UP); Assert.AreEqual(fUp.GetCell(new XY(0, 0)), DungeonCell.Wall); Assert.AreEqual(fUp.GetCell(new XY(0, 1)), DungeonCell.Door); Assert.AreEqual(fUp.GetCell(new XY(1, 2)), DungeonCell.Wall); Assert.AreEqual(fUp.GetCell(new XY(2, 3)), DungeonCell.Door); // Test right var fRight = f1.Rotate(AtlasWarriorsGame.DungeonGenerators.Feature.Rotation.RIGHT); Assert.AreEqual(fRight.GetCell(new XY(3, 0)), DungeonCell.Wall); Assert.AreEqual(fRight.GetCell(new XY(2, 0)), DungeonCell.Door); Assert.AreEqual(fRight.GetCell(new XY(1, 1)), DungeonCell.Wall); Assert.AreEqual(fRight.GetCell(new XY(0, 2)), DungeonCell.Door); // Test down var fDown = f1.Rotate(AtlasWarriorsGame.DungeonGenerators.Feature.Rotation.DOWN); Assert.AreEqual(fDown.GetCell(new XY(2, 3)), DungeonCell.Wall); Assert.AreEqual(fDown.GetCell(new XY(2, 2)), DungeonCell.Door); Assert.AreEqual(fDown.GetCell(new XY(1, 1)), DungeonCell.Wall); Assert.AreEqual(fDown.GetCell(new XY(0, 0)), DungeonCell.Door); // Test left var fLeft = f1.Rotate(AtlasWarriorsGame.DungeonGenerators.Feature.Rotation.LEFT); Assert.AreEqual(fLeft.GetCell(new XY(0, 2)), DungeonCell.Wall); Assert.AreEqual(fLeft.GetCell(new XY(1, 2)), DungeonCell.Door); Assert.AreEqual(fLeft.GetCell(new XY(2, 1)), DungeonCell.Wall); Assert.AreEqual(fLeft.GetCell(new XY(3, 0)), DungeonCell.Door); }
public void SetUp() { Feature = new AtlasWarriorsGame.DungeonGenerators.Feature(10, 10); }