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


C# Map.CreateCorridorSide方法代码示例

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


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

示例1: ConvertToDungeon_Dungeon_HasDoor_IfMapContainsDoor

        public void ConvertToDungeon_Dungeon_HasDoor_IfMapContainsDoor()
        {
            var converter = new MapConverter();
            var map = new Map(5, 5);
            var cell1 = map[1, 2];
            var cell2 = map[1, 2];
            map.CreateCorridorSide(map[1, 2], map[2, 2], Dir.E, Side.Door);

            var dungeon = converter.ConvertToDungeon(map);

            Assert.That(dungeon,
                Has.Some.With.Property(nameof(Cell.Type)).EqualTo(XType.DoorClosed));
        }
开发者ID:CatSkald,项目名称:Roguelike,代码行数:13,代码来源:MapConverterTests.cs

示例2: ConvertToDungeon_Dungeon_HasSomeEmptyCells_IfMapContainsCorridor

        public void ConvertToDungeon_Dungeon_HasSomeEmptyCells_IfMapContainsCorridor()
        {
            var converter = new MapConverter();
            var map = new Map(5, 5);
            map.CreateCorridorSide(map[1, 2], map[2, 2], Dir.E, Side.Empty);

            var dungeon = converter.ConvertToDungeon(map);

            Assert.That(dungeon,
                Has.Some.With.Property(nameof(Cell.Type)).EqualTo(XType.Empty),
                "Non borders should be empty.");

            Assert.That(
                dungeon.Where(c => c.Location.X == 0
                    || c.Location.X == dungeon.Width - 1
                    || c.Location.Y == 0
                    || c.Location.Y == dungeon.Height - 1),
                Has.All.With.Property(nameof(Cell.Type)).EqualTo(XType.Wall),
                "Borders should be walls.");
        }
开发者ID:CatSkald,项目名称:Roguelike,代码行数:20,代码来源:MapConverterTests.cs

示例3: CreateCorridorSide_ThrowsForNonAjacentCells

        public void CreateCorridorSide_ThrowsForNonAjacentCells(
            int x1, int y1, int x2, int y2, Dir corridorDirection)
        {
            var map = new Map(5, 5);

            var startCell = map[x1, y1];
            var endCell = map[x2, y2];

            Assert.That(() =>
                map.CreateCorridorSide(startCell, endCell, corridorDirection, Side.Empty),
                Throws.InvalidOperationException);
        }
开发者ID:CatSkald,项目名称:Roguelike,代码行数:12,代码来源:MapTests.cs

示例4: CreateCorridorSide_CorridorCreatedCorrectly

        public void CreateCorridorSide_CorridorCreatedCorrectly(
            int x1, int y1, int x2, int y2, Dir corridorDir, Dir oppositeDir)
        {
            var map = new Map(5, 5);
            var startCell = map[x1, y1];
            var endCell = map[x2, y2];
            var emptySide = Side.Empty;

            map.CreateCorridorSide(startCell, endCell, corridorDir, emptySide);

            Assert.That(startCell.Sides[corridorDir], Is.EqualTo(emptySide));
            Assert.That(startCell.Sides.Where(s => s.Key != corridorDir),
                Has.All.With.Property("Value").EqualTo(Side.Wall));

            Assert.That(endCell.Sides[oppositeDir], Is.EqualTo(emptySide));
            Assert.That(endCell.Sides.Where(s => s.Key != oppositeDir),
                Has.All.With.Property("Value").EqualTo(Side.Wall));
        }
开发者ID:CatSkald,项目名称:Roguelike,代码行数:18,代码来源:MapTests.cs


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