Ejemplo n.º 1
0
        public void CreateNebula(NebulaType type)
        {
            this.type = type;

            switch( type){
            case NebulaType.Cloudy:

                NebulaLayer layer = new NebulaLayer();
                layers.Add( layer);

                layer = new NebulaLayer();
                layers.Add( layer);

                RandomCloudyColor();
                RandomCloudy(Helper.GetRandomEnum<NebulaLayer.OverlayStyle>());

                break;

            case NebulaType.Veined:
                layer = new NebulaLayer();
                layers.Add( layer);

                layer = new NebulaLayer();
                layers.Add( layer);

                layer = new NebulaLayer();
                layers.Add( layer);

                RandomVeined();
                RandomVeinedColor();
                break;
            }
        }
Ejemplo n.º 2
0
        public void RandomCloudy(NebulaLayer.OverlayStyle overStyle)
        {
            int variation = UnityEngine.Random.Range(1,1000);

            layers[0].enable = true;
            layers[0].blend = TextureTools.BlendingMode.Color;
            layers[0].fractal.type = Fractal.FractalType.Fbm;
            layers[0].fractal.octave = 8;
            layers[0].fractal.zoom = UnityEngine.Random.Range(40f,100f);
            layers[0].fractal.seed = variation;
            layers[0].fractal.lacunarity = 2;
            layers[0].fractal.frequency = 2;
            layers[0].fractal.gain=0;
            layers[0].fractal.offset=0;
            layers[0].fractal.threshold=0;
            layers[0].fractal.power =1;

            layers[1].enable = true;
            layers[1].blend = TextureTools.BlendingMode.Mask;
            layers[1].fractal.type = Fractal.FractalType.Ridged;
            layers[1].fractal.octave = 8;
            layers[1].fractal.seed = variation;
            layers[1].fractal.lacunarity = 1.8f;
            layers[1].fractal.frequency =0.5f;
            layers[1].fractal.gain = 25f;

            layers[1].fractal.offset = 0.48f;
            layers[1].fractal.threshold = 0;
            layers[1].fractal.power =1;

            NebulaLayer.OverlayStyle over = Helper.GetRandomEnum<NebulaLayer.OverlayStyle>();

            over = overStyle;
            switch (over){
            case NebulaLayer.OverlayStyle.Style1:
                layers[1].blend = TextureTools.BlendingMode.Mask;
                layers[1].overlay = over;
                layers[1].fractal.zoom = UnityEngine.Random.Range(30,300);//120

                this.power = UnityEngine.Random.Range(0.9f,1.2f);
                layers[1].threshold = UnityEngine.Random.Range(0.2f,0.3f );

                layers[1].fractal.threshold  = 0;
                break;
            case NebulaLayer.OverlayStyle.Style2:
                layers[1].blend = TextureTools.BlendingMode.Alpha;
                layers[1].overlay = over;
                layers[1].fractal.zoom = UnityEngine.Random.Range(29,69);

                this.power = UnityEngine.Random.Range(1f,1.8f);
                layers[1].threshold = UnityEngine.Random.Range(0.25f,0.5f );

                layers[1].fractal.threshold  = UnityEngine.Random.Range(0.25f, 0.4f);
                break;
            }
        }