Example #1
0
        private static void CreateNodes(IMap map,
                                        int startX,
                                        int startY,
                                        int mapSize,
                                        OptionsDelegate optionsDelegate)
        {
            var nodeIdCounter = 1;

            for (var row = startY; row < startY + mapSize; row++)
            {
                for (var col = startX; col < startX + mapSize; col++)
                {
                    HexNodeOptions options;
                    if (optionsDelegate != null)
                    {
                        options = optionsDelegate(col, row);
                    }
                    else
                    {
                        options = new HexNodeOptions
                        {
                            IsObstacle = false
                        };
                    }

                    var node = new HexNode(col, row, options.IsObstacle)
                    {
                        Id = nodeIdCounter++
                    };

                    map.AddNode(node);
                }
            }
        }
Example #2
0
 public ConanOptions(
     IMenuCommandService commandService,
     Core.IErrorListService errorListService,
     OptionsDelegate optionsDelegate)
     : base(commandService, errorListService)
 {
     _optionsDelegate = optionsDelegate;
 }
Example #3
0
 public static void FillSquareMap(IMap map,
                                  int startX,
                                  int startY,
                                  int mapSize,
                                  OptionsDelegate optionsDelegate = null)
 {
     CreateNodes(map, startX, startY, mapSize, optionsDelegate);
     CreateEdges(map);
 }