Ejemplo n.º 1
0
        public void AddMapLayer()
        {
            // Arrange
            var mapLayer  = new PathedMapLayer <int>();
            var mapLayer2 = new MapLayer <bool>();

            var map = new LayeredMap(LayoutOrientation.Flat, new Vector2(1, 1), new Vector2(0, 0), mapLayer);

            // Act
            map.AddLayer(mapLayer2);

            // Assert
            Assert.Multiple(() =>
            {
                Assert.IsTrue(map[0] is PathedMapLayer <int>);
                Assert.IsTrue(map[1] is MapLayer <bool>);
            });
        }
Ejemplo n.º 2
0
        public void CalculatedTileWeights_PathedAndUnpathedLayer_UnpathedLayerEmpty()
        {
            // Arrange
            var testHex        = new Hex(2, 3);
            var pathedMapLayer = new PathedMapLayer <bool>();

            pathedMapLayer[testHex] = new PathedTile <bool>(true, 3, true);

            var unpathedMapLayer = new MapLayer <bool>();

            var map = new LayeredMap(LayoutOrientation.Flat, new Vector2(10, 10), new Vector2(100, 100), pathedMapLayer);

            map.AddLayer(unpathedMapLayer);

            // Act
            var pathingInfo = map.CalculatedTileWeights();

            // Assert
            Assert.AreEqual(3, pathingInfo[testHex]);
        }
Ejemplo n.º 3
0
        public void CalculatedTileWeights_PathedAndUnpathedLayer_UnpathedLayerOccupied_ClearsPathing()
        {
            // Arrange
            var testHex        = new Hex(2, 3);
            var pathedMapLayer = new PathedMapLayer <bool>();

            pathedMapLayer[testHex] = new PathedTile <bool>(true, 3, true);

            var unpathedMapLayer = new MapLayer <bool>();

            unpathedMapLayer[testHex] = true;

            var map = new LayeredMap(LayoutOrientation.Flat, new Vector2(10, 10), new Vector2(100, 100), pathedMapLayer);

            map.AddLayer(unpathedMapLayer);

            // Act
            var pathingInfo = map.CalculatedTileWeights();

            // Assert
            Assert.IsTrue(!pathingInfo.ContainsKey(testHex));
        }