public static GeneratorsAsset Default()
        {
            GeneratorsAsset gens = ScriptableObject.CreateInstance <GeneratorsAsset>();

            //creating initial generators
            NoiseGenerator1 noiseGen = (NoiseGenerator1)gens.CreateGenerator(typeof(NoiseGenerator1), new Vector2(50, 50));

            noiseGen.intensity = 0.75f;

            CurveGenerator curveGen = (CurveGenerator)gens.CreateGenerator(typeof(CurveGenerator), new Vector2(250, 50));

            curveGen.curve = new AnimationCurve(new Keyframe[] { new Keyframe(0, 0, 0, 0), new Keyframe(1, 1, 2.5f, 1) });

            HeightOutput heightOut = (HeightOutput)gens.CreateGenerator(typeof(HeightOutput), new Vector2(450, 50));

            curveGen.input.Link(noiseGen.output, noiseGen);
            heightOut.input.Link(curveGen.output, curveGen);

            return(gens);
        }
Esempio n. 2
0
			void CreateGenerator (System.Type type, Vector2 guiPos)
			{
				Undo.RecordObject (gens, "MapMagic Create Generator");
				gens.setDirty = !gens.setDirty;

				Generator gen = gens.CreateGenerator(type, guiPos);

				if (mapMagic != null)
				{
					mapMagic.ClearResults(gen);
					mapMagic.Generate();
				}

				repaint=true; Repaint(); 

				EditorUtility.SetDirty(gens);
			}