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.
Inheritance: ICloneable
Exemplo n.º 1
0
 public EmptyMapGenState([NotNull] MapGeneratorParameters genParams)
 {
     if (genParams == null)
     {
         throw new ArgumentNullException("genParams");
     }
     Parameters = genParams;
 }
Exemplo n.º 2
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());
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
 public EmptyMapGenState(MapGeneratorParameters genParams)
 {
     Parameters = genParams;
 }
Exemplo n.º 5
0
 public override void SetParameters(MapGeneratorParameters generatorParameters) {
     genParameters = (RealisticMapGenParameters)generatorParameters;
     LoadGeneratorArgs();
 }
Exemplo n.º 6
0
 public override void SetParameters( MapGeneratorParameters generatorParameters ) {
     genParams = generatorParameters;
     pgDetails.SelectedObject = genParams;
     lPreset.Text = "Preset: " + genParams.ToString().Split( ' ' )[1];
 }
Exemplo n.º 7
0
 public EmptyMapGenState( MapGeneratorParameters genParams ) {
     Parameters = genParams;
 }
Exemplo n.º 8
0
 public override void SetParameters( MapGeneratorParameters generatorParameters ) {
     args = generatorParameters;
     pgGrid.SelectedObject = args;
 }