public void ConnectToNode(Map.Map.Position fromPosition, Map.Map.Position toPosition) { PathNode fromNode, toNode; Map.Direction fromDirection, toDirection; int dr, dc; dr = fromPosition.Row - toPosition.Row; dc = fromPosition.Column - toPosition.Column; if (dr == 0) { fromDirection = dc > 0 ? Map.Direction.North : Map.Direction.South; toDirection = dc > 0 ? Map.Direction.South : Map.Direction.North; } else { fromDirection = dr > 0 ? Map.Direction.East : Map.Direction.West; toDirection = dr > 0 ? Map.Direction.West : Map.Direction.East; } fromNode = nodes[map.PositionToIndex (fromPosition)]; toNode = nodes[map.PositionToIndex (toPosition)]; fromNode.ValidExits |= fromDirection; toNode.ValidExits |= toDirection; OnPathChanged (); }
public RandomWalker(Map map, WalkerForm walkerForm) { PathImage = new Bitmap(map.Size.Width, map.Size.Height); g = Graphics.FromImage(PathImage); boardBounds = new Rectangle(0, 0, map.Size.Width, map.Size.Height); obstructions = map.Obstructions; }
public WalkerForm(Map map) { this.map = map; mapSize = map.Size; InitializeComponent(mapSize); this.mapDisplay.map = map; walker = new RandomWalker(map, this); walker.InitiateRandomWalk(new Vector(map.Size.Width / 2, map.Size.Height / 2)); }
public Path(Map.Map _map) { map = _map; nodes = new PathNode[map.Width * map.Height]; }