コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public void GetSet(XY coord, DungeonCell value)
 {
     // Set it, then get it
     Feature.SetCell(coord, value);
     Assert.AreEqual(Feature.GetCell(coord), value, "Get or set didn't work");
 }