Esempio n. 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;
        }
Esempio n. 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;
        }
Esempio n. 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);
            }
        }