public override void PlaceVertex(MazePoint p, Direction d)
        {
            MazePoint finalPoint;

            if (_movementHelper.CanMove(p, d, Size, out finalPoint))
            {
                MazeCell cell;
                switch (d)
                {
                case Direction.Right:
                case Direction.Up:
                case Direction.Forward:
                    cell            = Maze[p.X, p.Y, p.Z];
                    cell.Directions = _flagParser.AddDirectionsToFlag(cell.Directions, d);
                    break;

                case Direction.Left:
                case Direction.Down:
                case Direction.Back:
                    cell            = Maze[finalPoint.X, finalPoint.Y, finalPoint.Z];
                    cell.Directions = _flagParser.AddDirectionsToFlag(cell.Directions,
                                                                      _flagParser.OppositeDirection(d));
                    break;

                default:
                    throw new ArgumentException(String.Format("Flag not supported: {0}", d));
                }
            }
        }
        public override void PlaceVertex(MazePoint p, Direction d)
        {
            var       startCell = Maze[p.X, p.Y, p.Z];
            MazePoint finalPoint;

            if (_movementHelper.CanMove(p, d, Size, out finalPoint))
            {
                var finalCell = Maze[finalPoint.X, finalPoint.Y, finalPoint.Z];
                startCell.Directions = _flagParser.AddDirectionsToFlag(startCell.Directions, d);
                finalCell.Directions = _flagParser.AddDirectionsToFlag(finalCell.Directions,
                                                                       _flagParser.OppositeDirection(d));
            }
        }
Example #3
0
        public override void PlaceVertex(MazePoint p, Direction d)
        {
            MazeCell  startCell;
            MazePoint final;
            MazeCell  finalCell;

            if (Maze.TryGetValue(p, out startCell) && _movementHelper.CanMove(p, d, Size, out final) && Maze.TryGetValue(final, out finalCell))
            {
                startCell.Directions = _flagParser.AddDirectionsToFlag(startCell.Directions, d);
                finalCell.Directions = _flagParser.AddDirectionsToFlag(finalCell.Directions,
                                                                       _flagParser.OppositeDirection(d));
            }
        }