コード例 #1
0
        Dictionary <bbPos, bbLand> InitializeLandsFromMidpointDisplacement(int _N, Dictionary <string, bbPos> pm)
        {
            Dictionary <bbPos, bbLand> landsDict = new Dictionary <bbPos, bbLand>();

            MidpointDisplacement mpd = new MidpointDisplacement(_N, wrapEastWest, wrapNorthSouth);

            float[,] elevation = mpd.Elevation;
            MapUtil.TransformMapMinMax(ref elevation, MapUtil.dNormalize);
            foreach (bbPos p in pm.Values)
            {
                bbLand newLand = new bbLand(p);
                newLand.setFromValue(elevation[(int)p.gridLoc.x(), (int)p.gridLoc.y()]);
                landsDict[p] = newLand;
            }

            return(landsDict);
        }
コード例 #2
0
        Dictionary <bbPos, bbLand> InitializeLandsFromMapGen(int _N, Dictionary <string, bbPos> pm)
        {
            Dictionary <bbPos, bbLand> landsDict = new Dictionary <bbPos, bbLand>();

            MapGen map = new MapGen(dim, dim);

            map.GenerateMap();
            float[,] elevation = map.Elevation;
            MapUtil.TransformMapMinMax(ref elevation, MapUtil.dNormalize);
            foreach (bbPos p in pm.Values)
            {
                bbLand newLand = new bbLand(p);
                newLand.setFromValue(elevation[(int)p.gridLoc.x(), (int)p.gridLoc.y()]);
                landsDict[p] = newLand;
            }

            return(landsDict);
        }