本文整理汇总了C#中Maze.Width方法的典型用法代码示例。如果您正苦于以下问题:C# Maze.Width方法的具体用法?C# Maze.Width怎么用?C# Maze.Width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maze
的用法示例。
在下文中一共展示了Maze.Width方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WorldPathFromPosition
public static Vector3[] WorldPathFromPosition(Position startPosition, Position endPosition, Maze maze)
{
setGoalPosition(endPosition);
int w = maze.Width();
int h = maze.Height();
bool[][] path = Util.InitializeMatrixAsJaggedArray(new bool[w][], w, h);
bool[][] visited = Util.InitializeMatrixAsJaggedArray(new bool[w][], w, h);
if (arraySearch(ref path,
ref visited,
startPosition.GetX(),
startPosition.GetY())) {
return MazePieceController.GetWorldPath(MazePiecesFromPositions(
pathFromSpaces(path, startPosition, new List<Position>()).ToArray(),
MazeController.Instance.GetMazePieceControllers()));
} else {
return null;
}
}
示例2: getTorchPositions
private Position[] getTorchPositions(Maze maze, int torchSpacing = 3)
{
int numTorches = (int) Mathf.Pow(Mathf.Min (maze.Height(), maze.Width())/torchSpacing - 1, 2.0f);
Position [] torchPositions = new Position[numTorches];
int noWallFoundOffset = 0;
for (int x = 0; x < Mathf.Sqrt(numTorches); x++) {
for (int y = 0; y < Mathf.Sqrt(numTorches); y++) {
Position currentTorchPosition = getRandomWallPositionInRange(maze,
new Position(torchSpacing * x, torchSpacing * y),
new Position(torchSpacing * (x + 1), torchSpacing * (y + 1)));
if (currentTorchPosition == null) {
noWallFoundOffset++;
} else {
if (currentTorchPosition == null) {
Debug.Log(x + " " + y + " " + currentTorchPosition);
}
torchPositions[x * (int) Mathf.Sqrt(numTorches) + y - noWallFoundOffset] = currentTorchPosition;
}
}
}
return Util.RemoveNullElements(torchPositions);
}