Пример #1
0
        public Orientations GetRandomValidOrientation(Point2 position, MazeChunk[,] map)
        {
            orientations.Shuffle();

            for (int i = 0; i < orientations.Length; i++)
            {
                var orientation = orientations[i];
                var adjustedPoint = position + ToDirection(orientation);

                if (map.ContainsPoint(adjustedPoint) && map.Get(adjustedPoint) == null)
                    return orientation;
            }

            return Orientations.Right;
        }
Пример #2
0
        public bool HasValidOrientation(Point2 position, MazeChunk[,] map)
        {
            for (int i = 0; i < orientations.Length; i++)
            {
                var orientation = orientations[i];
                var adjustedPoint = position + ToDirection(orientation);

                if (map.ContainsPoint(adjustedPoint) && map.Get(adjustedPoint) == null)
                    return true;
            }

            return false;
        }
Пример #3
0
        public void CreateWalls(MazeChunk chunk, MazeChunk[,] map)
        {
            for (int i = 0; i < orientations.Length; i++)
            {
                var orientation = orientations[i];
                var adjustedPoint = chunk.Position + ToDirection(orientation);

                if (orientation == ToOpposite(chunk.Orientation))
                    continue;

                if (!map.ContainsPoint(adjustedPoint) || map.Get(adjustedPoint) != null)
                    CreateWall(chunk, orientation);
            }
        }