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


C# Maze.Height方法代码示例

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


在下文中一共展示了Maze.Height方法的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;
        }
    }
开发者ID:imann24,项目名称:VR,代码行数:19,代码来源:MazePositioner.cs

示例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);
    }
开发者ID:imann24,项目名称:VR,代码行数:23,代码来源:MazeController.cs


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