public BuilderViewModel(Map map)
        {
            Model = new Builder();
            View  = new BuilderView();

            _map            = map;
            _nearestPillars = new NearestPillars(_map);
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize an instance to calculate path details.
        /// </summary>
        /// <param name="map">Has to be at least 1x1.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <see cref="Map.Width"/> or <see cref="Map.Height"/> is less than 1.</exception>
        public PathGenerator(Map map, BuilderRules rules)
        {
            if (map.Width < 1)
            {
                throw new ArgumentOutOfRangeException($"{nameof(map.Width)} has to be at least 1.");
            }

            if (map.Height < 1)
            {
                throw new ArgumentOutOfRangeException($"{nameof(map.Height)} has to be at least 1.");
            }

            _map = map;

            int rowCount = (int)Math.Pow(Math.Max(map.Width, map.Height), 3);

            _results = new Path[rowCount];

            _nearestPillars = new NearestPillars(_map);
            _rules          = rules;
        }