public override InnerMap GoGenerate <M>(IInnerMapFactory <M> mapFactory, IRandomFactory randomFactory, Action <int, int, long, long> pixelChangedCallback)
        {
            var innerMap = mapFactory.Create();
            var random   = randomFactory.Create();

            return(GoGenerateInternal(innerMap, random, pixelChangedCallback));
        }
        public override InnerMap GoGenerate <M>(IInnerMapFactory <M> mapFactory, IRandomFactory randomFactory, Action <int, int, long, long> pixelChangedCallback)
        {
            if (typeof(M) != typeof(UndefinedInnerMap))
            {
                throw new InvalidOperationException("Please provide the map type 'UndefinedInnerMap' to this algorithm, else it will take memory that is not required.");
            }

            var innerMap = mapFactory.Create();

            Func <int, int, int, int, InnerMap> generateAction = (x, y, widthPart, heightPart) => GenerateMapPart(x, y, innerMap.Width, innerMap.Height, widthPart, heightPart, randomFactory);
            Action <InnerMap> storeAction = (x) => { };

            var totalMap = new CachedInnerMap(innerMap.Width, innerMap.Height, tilesCached, Math.Min(Math.Min(innerMap.Width, innerMap.Height), tileSize), generateAction, storeAction);

            return(totalMap);
        }
 public abstract InnerMap GoGenerate <M>(IInnerMapFactory <M> mapFactory, IRandomFactory randomFactory, Action <int, int, long, long> pixelChangedCallback) where M : InnerMap;
Пример #4
0
 public override InnerMap GoGenerate <M>(IInnerMapFactory <M> mapFactory, IRandomFactory randomFactory, Action <int, int, long, long> pixelChangedCallback)
 {
     return(GoGenerateWithPath(mapFactory, randomFactory, pixelChangedCallback));
 }