本文整理汇总了C#中Direction.ToDirectionsArray方法的典型用法代码示例。如果您正苦于以下问题:C# Direction.ToDirectionsArray方法的具体用法?C# Direction.ToDirectionsArray怎么用?C# Direction.ToDirectionsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direction
的用法示例。
在下文中一共展示了Direction.ToDirectionsArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeOpenings
private static void MakeOpenings(Tile[,] template, Direction openings)
{
const int size = CellBasedGenerator.CellSize - 1;
foreach (var opening in openings.ToDirectionsArray())
{
int x = 0, y = 0;
switch (opening)
{
case Direction.North:
x = size/2;
break;
case Direction.East:
x = size;
y = size/2;
break;
case Direction.South:
x = size/2;
y = size;
break;
case Direction.West:
y = size/2;
break;
default:
throw new ArgumentOutOfRangeException("openings");
}
template[x,y] = Tile.Floor;
}
}
示例2: FillCorridor
private static Tile[,] FillCorridor(Direction openings)
{
var template = MakeTemplate(CellBasedGenerator.CellSize);
var openingsArray = openings.ToDirectionsArray();
// carve the walls first, so that
foreach (var direction in openingsArray)
CarveCorridors(direction, template, true);
// we can do another pass with the floors later
foreach (var direction in openingsArray)
CarveCorridors(direction, template);
MakeOpenings(template, openings);
return template;
}