当前位置: 首页>>代码示例>>C#>>正文


C# Map.Clear方法代码示例

本文整理汇总了C#中Map.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Map.Clear方法的具体用法?C# Map.Clear怎么用?C# Map.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Map的用法示例。


在下文中一共展示了Map.Clear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Clear_IsTransparentTrueIsWalkableFalse_AllCellsHaveExpectedValues

        public void Clear_IsTransparentTrueIsWalkableFalse_AllCellsHaveExpectedValues()
        {
            Map map = new Map( 10, 10 );

             map.Clear( true, false );

             foreach ( Cell cell in map.GetAllCells() )
             {
            Assert.IsTrue( map.IsTransparent( cell.X, cell.Y ) );
            Assert.IsFalse( map.IsWalkable( cell.X, cell.Y ) );
             }
        }
开发者ID:hybrid1969,项目名称:RogueSharp,代码行数:12,代码来源:MapTest.cs

示例2: GridView_IsSolid

        public void GridView_IsSolid()
        {
            Map m = new Map(256, 256);
            m.AddLayer(new Layer("test"));
            m.ZoomAll();
            Grid g = new Grid(256, 256);
            m.Render(g);
            GridView v1 = g.View(0, 0, 256, 256);
            Assert.IsTrue(v1.IsSolid());

            m.Clear();
            g.Clear();
            Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
            m.Load(@".\data\test.xml");
            m.ZoomAll();
            m.Render(g);
            GridView v2 = g.View(0, 0, 256, 256);
            Assert.IsFalse(v2.IsSolid());
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:19,代码来源:GridViewTests.cs

示例3: Grid_Painted

        public void Grid_Painted()
        {
            Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
            Grid g = new Grid(256, 256);
            Assert.IsFalse(g.Painted());

            Map m = new Map(256, 256);
            Layer l = new Layer("test");
            m.AddLayer(l);
            m.Render(g);
            Assert.IsFalse(g.Painted());

            m.Clear();
            m.Load(@".\data\test.xml");
            m.ZoomAll();
            var options = new Dictionary<string, object>()
            {
                {"Fields", new List<string>() { "FIPS" } },
                {"Layer", "world" }
            };
            m.Render(g);
            Assert.IsTrue(g.Painted());
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:23,代码来源:GridTests.cs

示例4: ItClearsTheItemsOnClear

        public void ItClearsTheItemsOnClear()
        {
            var map = new Map();

            map.PlaceItem(2, MapItems.Player);
            map.PlaceItem(1, MapItems.Wumpus);

            map.Clear();

            Assert.AreEqual(0, map.ItemsInCavern(1).Count);
            Assert.AreEqual(0, map.ItemsInCavern(2).Count);
        }
开发者ID:paytonrules,项目名称:HuntTheWumpus,代码行数:12,代码来源:MapTest.cs

示例5: ItDoesntClearThePathsOnClear

        public void ItDoesntClearThePathsOnClear()
        {
            var map = new Map();

            map.AddPath(0, 1, Command.Directions.East);

            map.Clear();

            Assert.AreEqual(Command.Directions.East, map.AvailableMoves(0)[0]);
        }
开发者ID:paytonrules,项目名称:HuntTheWumpus,代码行数:10,代码来源:MapTest.cs

示例6: Map_Clone

        public void Map_Clone()
        {
            Map m = new Map(256, 256);
            m.AddLayer(new Layer("layer"));
            Map m2 = m.Clone();
            Assert.AreEqual(m.Layers().Count(), 1);
            Assert.AreEqual(m2.Layers().Count(), 1);

            m.Clear();
            Assert.AreEqual(m.Layers().Count(), 0);
            Assert.AreEqual(m2.Layers().Count(), 1);
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:12,代码来源:MapTests.cs

示例7: CyclePositionedCorrectlyWithCollisions

        public void CyclePositionedCorrectlyWithCollisions()
        {
            var gameConfig = new GameConfiguration(new CycleConfiguration(), new MapConfiguration());
            var map = new Map(gameConfig.MapConfig);
            var startPosition = new Vector3(0, gameConfig.CycleConfig.Y_OFFSET, 0);
            var cycle = new Cycle(1, startPosition, new Vector3(1, 0, 0), Math.PI + Math.PI * .5, 0xff0000, map, gameConfig);
            var requestValidator = new RequestValidator(map);
            var newPosition = startPosition.Clone();
            var collision = startPosition.Clone();
            newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 5;
            collision.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width * 3;

            cycle.MovementController.RequestedPosition = newPosition;
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            map[map.Utilities.ToMapLocation(cycle.MovementController)] = -cycle.ID;
            map[map.Utilities.ToMapLocation(collision)] = 5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(collision));

            map.Clear();
            newPosition = startPosition.Clone();
            newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width;
            cycle.MovementController.Position = startPosition;
            cycle.MovementController.RequestedPosition = newPosition;
            map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID;
            map[map.Utilities.ToMapLocation(newPosition)] = 5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(newPosition));

            map.Clear();
            newPosition = startPosition.Clone();
            newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width;
            cycle.MovementController.Position = startPosition;
            cycle.MovementController.RequestedPosition = newPosition;
            map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID;
            map[map.Utilities.ToMapLocation(newPosition)] = 5;
            newPosition.x += gameConfig.MapConfig.FLOOR_TILE_SIZE.Width;
            map[map.Utilities.ToMapLocation(newPosition)] = 5;
            newPosition.x -= gameConfig.MapConfig.FLOOR_TILE_SIZE.Width;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(newPosition));

            map.Clear();
            newPosition = map.Utilities.ToPosition(new MapLocation(23, 173),gameConfig.CycleConfig.Y_OFFSET);
            cycle.MovementController.Position = map.Utilities.ToPosition(new MapLocation(25, 173), gameConfig.CycleConfig.Y_OFFSET);
            cycle.MovementController.RequestedPosition = newPosition;
            cycle.MovementController.HeadLocation = map.Utilities.ToMapLocation(cycle.MovementController.Position);
            cycle.MovementController.Velocity = new Vector3(0, 0, -1);
            cycle.MovementController.Rotation = 0;
            map[map.Utilities.ToMapLocation(startPosition)] = -cycle.ID;
            map[new MapLocation(24,173)] = 5;
            requestValidator.ValidateRequestedPosition(cycle);

            Assert.True(cycle.MovementController.Position.SameAs(map.Utilities.ToPosition(new MapLocation(24, 173), gameConfig.CycleConfig.Y_OFFSET)));
        }
开发者ID:pksorensen,项目名称:CycleR,代码行数:58,代码来源:RequestValidatorFacts.cs


注:本文中的Map.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。