Ejemplo n.º 1
0
        public void Create_MapCreatedWithWidth40Height20BorderOnlyStrategy_ExpectedMap()
        {
            int expectedWidth  = 40;
            int expectedHeight = 20;
            IMapCreationStrategy <Map> mapCreationStrategy = new BorderOnlyMapCreationStrategy <Map>(expectedWidth, expectedHeight);

            IMap map = Map.Create(mapCreationStrategy);

            Trace.Write(map);

            Assert.AreEqual(expectedWidth, map.Width);
            Assert.AreEqual(expectedHeight, map.Height);

            for (int x = 0; x < map.Width; x++)
            {
                Assert.IsFalse(map.IsTransparent(x, 0));
                Assert.IsFalse(map.IsWalkable(x, 0));
                Assert.IsFalse(map.IsTransparent(x, map.Height - 1));
                Assert.IsFalse(map.IsWalkable(x, map.Height - 1));
            }

            for (int y = 0; y < map.Height; y++)
            {
                Assert.IsFalse(map.IsTransparent(0, y));
                Assert.IsFalse(map.IsWalkable(0, y));
                Assert.IsFalse(map.IsTransparent(map.Width - 1, y));
                Assert.IsFalse(map.IsWalkable(map.Width - 1, y));
            }
        }
Ejemplo n.º 2
0
        private Map CreateBossMap(int mapWidth, int mapHeight)
        {
            IMapCreationStrategy <Map> mapCreationStrategy =
                new BorderOnlyMapCreationStrategy <Map>(mapWidth, mapHeight);
            Map map = Map.Create(mapCreationStrategy);

            return(map);
        }
Ejemplo n.º 3
0
        public void Create_MapCreatedWithWidth40Height20BorderOnlyStrategy_ExpectedMap()
        {
            int expectedWidth = 40;
             int expectedHeight = 20;
             IMapCreationStrategy<LibtcodMap> mapCreationStrategy = new BorderOnlyMapCreationStrategy<LibtcodMap>( expectedWidth, expectedHeight );

             IMap map = LibtcodMap.Create( mapCreationStrategy );
             Trace.Write( map );

             Assert.AreEqual( expectedWidth, map.Width );
             Assert.AreEqual( expectedHeight, map.Height );

             for ( int x = 0; x < map.Width; x++ )
             {
            Assert.IsFalse( map.IsTransparent( x, 0 ) );
            Assert.IsFalse( map.IsWalkable( x, 0 ) );
            Assert.IsFalse( map.IsTransparent( x, map.Height - 1 ) );
            Assert.IsFalse( map.IsWalkable( x, map.Height - 1 ) );
             }

             for ( int y = 0; y < map.Height; y++ )
             {
            Assert.IsFalse( map.IsTransparent( 0, y ) );
            Assert.IsFalse( map.IsWalkable( 0, y ) );
            Assert.IsFalse( map.IsTransparent( map.Width - 1, y ) );
            Assert.IsFalse( map.IsWalkable( map.Width - 1, y ) );
             }
        }