Represents a set of map generator parameters. Provides a way to serialize these parameters to string, and a way to create single-use MapGeneratorState objects. Must be mutable, should implement parameter range validation in property setters, and implement ICloneable, and pass a COPY to MapGeneratorState.
Наследование: ICloneable
Пример #1
0
        public static MapGeneratorState MakeFlatgrass(int width, int length, int height)
        {
            MapGeneratorParameters preset = Instance.CreateDefaultParameters();

            preset.MapWidth  = width;
            preset.MapLength = length;
            preset.MapHeight = height;
            return(preset.CreateGenerator());
        }
Пример #2
0
        /// <summary> Embeds given map generation parameters in a map file. </summary>
        /// <param name="mapGenParams"> Parameters to embed. </param>
        /// <param name="map"> Map to embed parameters in. </param>
        /// <exception cref="ArgumentNullException"> mapGenParams or map is null. </exception>
        public static void SaveToMap([NotNull] this MapGeneratorParameters mapGenParams, [NotNull] Map map)
        {
            if (mapGenParams == null)
            {
                throw new ArgumentNullException("mapGenParams");
            }
            if (map == null)
            {
                throw new ArgumentNullException("map");
            }
            XElement el = new XElement(ParamsMetaKey);

            mapGenParams.Save(el);
            map.Metadata[ParamsMetaGroup, ParamsMetaKey]     = el.ToString(SaveOptions.DisableFormatting);
            map.Metadata[ParamsMetaGroup, GenNameMetaKey]    = mapGenParams.Generator.Name;
            map.Metadata[ParamsMetaGroup, GenVersionMetaKey] = mapGenParams.Generator.Version.ToString();
        }
Пример #3
0
 public EmptyMapGenState(MapGeneratorParameters genParams)
 {
     Parameters = genParams;
 }
Пример #4
0
 public EmptyMapGenState( MapGeneratorParameters genParams ) {
     Parameters = genParams;
 }