本文整理汇总了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));
}
示例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.");
}
示例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);
}
示例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));
}