ApplyTheme() public method

public ApplyTheme ( MapGenTheme theme ) : void
theme MapGenTheme
return void
示例#1
0
        public override MapGeneratorParameters CreateParameters( string presetName ) {
            if( presetName == null ) {
                throw new ArgumentNullException( "presetName" );

            } else if( presetName.Equals( Presets[0], StringComparison.OrdinalIgnoreCase ) ) {
                // "Default"
                return new FlatMapGenParameters {
                    Preset = Presets[0]
                };

            } else if( presetName.Equals( Presets[1], StringComparison.OrdinalIgnoreCase ) ) {
                // "Ocean"
                return new FlatMapGenParameters {
                    SurfaceThickness = 0,
                    SoilThickness = 0,
                    BedrockThickness = 0,
                    DeepBlock = Block.Water,
                    Preset = Presets[1]
                };

            } else {
                MapGenTheme theme;
                if( EnumUtil.TryParse( presetName, out theme, true ) ) {
                    FlatMapGenParameters genParams = new FlatMapGenParameters();
                    genParams.ApplyTheme( theme );
                    return genParams;
                } else {
                    return null;
                }
            }
        }
示例#2
0
 public override MapGeneratorParameters CreateParameters(string presetName)
 {
     if (presetName == null)
     {
         throw new ArgumentNullException("presetName");
     }
     else if (presetName.Equals(Presets[0], StringComparison.OrdinalIgnoreCase))
     {
         // "Default"
         return(new FlatMapGenParameters {
             Preset = Presets[0]
         });
     }
     else if (presetName.Equals(Presets[1], StringComparison.OrdinalIgnoreCase))
     {
         // "Ocean"
         return(new FlatMapGenParameters {
             SurfaceThickness = 0,
             SoilThickness = 0,
             BedrockThickness = 0,
             DeepBlock = Block.Water,
             Preset = Presets[1]
         });
     }
     else
     {
         MapGenTheme theme;
         if (EnumUtil.TryParse(presetName, out theme, true))
         {
             FlatMapGenParameters genParams = new FlatMapGenParameters();
             genParams.ApplyTheme(theme);
             return(genParams);
         }
         else
         {
             return(null);
         }
     }
 }