Example #1
0
// Only we manage the changes of variables in the inspector of Unity, not be used in gametime when
// everything is setup.
    void  Update()
    {
        CloudParticle MyCloudParticle;
        int           i;

        // Create the procedural Texture Object of PT1 texture is selected in runtime.
        if (TypeClouds == Type.PT1 && !ProceduralTexture)
        {
            GameObject PText1 = new GameObject();
            PText1.name = "CloudsToyPT1";
            PText1.transform.position = Vector3.zero;
            PText1.transform.rotation = Quaternion.identity;
            PText1.transform.parent   = MyTransform;
            ProceduralTexture         = (ProceduralCloudTexture)PText1.AddComponent("ProceduralCloudTexture");
            PT1CopyInitialParameters();

            // Create the procedural materials to use in the clouds if PT1 had been selected.
            CloudsPTMatAdditive = new Material(Shader.Find("FX/CloudBright"));
            if (ProceduralTexture.IsInicialized())
            {
                CloudsPTMatAdditive.mainTexture = ProceduralTexture.MyTexture;
            }
            // Fourth type of Clouds. Procedural Blended textures
            CloudsPTMatBlended = new Material(Shader.Find("FX/CloudRealistic"));
            CloudsPTMatBlended.SetColor("_TintColor", CloudColor);
            if (ProceduralTexture.IsInicialized())
            {
                CloudsPTMatBlended.mainTexture = ProceduralTexture.MyAlphaTexture;
            }
        }

        // Trying to Assign a procedural txeture, once the texture is already created, not earlyer
        // PT1 needs time to be created and inicialized, that's why this code exits
        if (ProceduralTexture)
        {
            if (ProceduralTexture.IsInicialized() && !bAssignProcTexture)
            {
                // Procedural Additive textures
                CloudsPTMatAdditive.mainTexture = ProceduralTexture.MyTexture;
                // Procedural Blended textures
                CloudsPTMatBlended.SetColor("_TintColor", CloudColor);
                CloudsPTMatBlended.mainTexture = ProceduralTexture.MyAlphaTexture;

                if (TypeClouds == Type.PT1)
                {
                    for (i = 0; i < MaximunClouds; i++)
                    {
                        MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                        if (i < NumberClouds)
                        {
                            MyCloudParticle.SetActive(true);
                            MyCloudParticle.UpdateCloudsPosition();
                            if (CloudRender == TypeRender.Realistic)
                            {
                                MyCloudParticle.SetMainColor(CloudColor);
                            }
                            PaintTheParticlesShadows(MyCloudParticle);
                        }
                    }
                }
                bAssignProcTexture = true;
            }
        }

        // Change the number of visible clouds. Must activate the new particles and Update de position of the particles in the ellipse
        if (NumberCloudsAnt != NumberClouds)
        {
            for (i = 0; i < MaximunClouds; i++)
            {
                MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                if (i < NumberClouds && !MyCloudParticle.IsActive())
                {
                    MyCloudParticle.SetActive(true);
                    MyCloudParticle.UpdateCloudsPosition();
                    if (SoftClouds)
                    {
                        SoftCloudsAnt = !SoftClouds;
                    }
                }
                else
                if (i >= NumberClouds && MyCloudParticle.IsActive())
                {
                    MyCloudParticle.DesactivateRecursively();
                }
            }
            NumberCloudsAnt = NumberClouds;
        }
        // Actualize the particle emmitter if the density of particles emmited has changed by user
        if (CloudDetailAnt != CloudDetail)
        {
            if (CloudDetail == TypeDetail.Low)
            {
                EmissionMult   = 1;
                SizeFactorPart = 1;
            }
            else
            if (CloudDetail == TypeDetail.Normal)
            {
                EmissionMult   = 1.5f;
                SizeFactorPart = 1.2f;
            }
            else
            if (CloudDetail == TypeDetail.High)
            {
                EmissionMult   = 2.0f;
                SizeFactorPart = 1.3f;
            }
            for (i = 0; i < NumberClouds; i++)
            {
                MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                MyCloudParticle.SetCloudEmitter(i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
                MyCloudParticle.SetActive(true);
                MyCloudParticle.UpdateCloudsPosition();
                if (CloudRender == TypeRender.Realistic)
                {
                    MyCloudParticle.SetMainColor(CloudColor);
                }
                PaintTheParticlesShadows(MyCloudParticle);
            }
            CloudDetailAnt = CloudDetail;
        }
        // if change the Size or amount of particles emmitted by any Cloud, must update the partice emmitter and emit again.
        // after that, we ensure the particles are in the assigned ellipsoid of the cloud
        if (SizeFactorPartAnt != SizeFactorPart || EmissionMultAnt != EmissionMult)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                MyCloudParticle.SetCloudEmitter(i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
                MyCloudParticle.SetActive(true);
                MyCloudParticle.UpdateCloudsPosition();
            }
            SizeFactorPartAnt = SizeFactorPart;
            EmissionMultAnt   = EmissionMult;
        }
        // Are soft clouds? Update the particle emmitter and renderer to take care of the change
        if (SoftCloudsAnt != SoftClouds)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                MyCloudParticle.SetCloudEmitter(i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
                MyCloudParticle.SoftCloud(SoftClouds);
                MyCloudParticle.SetActive(true);
                MyCloudParticle.UpdateCloudsPosition();
            }
            SoftCloudsAnt = SoftClouds;
        }
        //  this two vars, only are visibles if softClouds are true, otherwise any change will not be advised
        if (SpreadDirAnt != SpreadDir || LengthSpreadAnt != LengthSpread)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                MyCloudParticle.SetLengthScale(LengthSpread);
                if (SpreadDirAnt != SpreadDir)
                {
                    MyCloudParticle.SetWorldVelocity(SpreadDir);
                    MyCloudParticle.SetActive(true);
                    MyCloudParticle.UpdateCloudsPosition();
                }
            }
            SpreadDirAnt    = SpreadDir;
            LengthSpreadAnt = LengthSpread;
        }
        // Changin the clouds width or tall. Must redefine all the cloud parameters, including his name
        if (MaxWithCloud != MaxWithCloudAnt || MaxTallCloud != MaxTallCloudAnt || MaxDepthCloud != MaxDepthCloudAnt)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                // Define some main particle properties
                if (TypeClouds == Type.Nimbus1 || TypeClouds == Type.Nimbus2 ||
                    TypeClouds == Type.Nimbus3 || TypeClouds == Type.Nimbus4 ||
                    TypeClouds == Type.MixNimbus || TypeClouds == Type.MixAll || TypeClouds == Type.PT1)
                {
                    MyCloudParticle.DefineCloudProperties(i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 0, FixedSize, true, true);
                }
                else
                if (TypeClouds == Type.Cirrus1 || TypeClouds == Type.Cirrus2 || TypeClouds == Type.MixCirrus)
                {
                    MyCloudParticle.DefineCloudProperties(i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 1, FixedSize, true, true);
                }
                // Change the emitter params of the cloud to adjust the new size.
                MyCloudParticle.SetCloudEmitter(i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
                // Start emit again, my friend.
                MyCloudParticle.SetActive(true);
                //  Update the position of the particles emmitted inside the ellipsoid
                MyCloudParticle.UpdateCloudsPosition();
                // Colorize the cloud
                if (CloudRender == TypeRender.Realistic)
                {
                    MyCloudParticle.SetMainColor(CloudColor);
                }
                PaintTheParticlesShadows(MyCloudParticle);
            }
            MaxWithCloudAnt  = MaxWithCloud;
            MaxTallCloudAnt  = MaxTallCloud;
            MaxDepthCloudAnt = MaxDepthCloud;
        }
        // If change the type of cloud just meaning i must change his material or render mode
        // also assign again the new texture if the procedural texture has changed.
        if (TypeCloudsAnt != TypeClouds || CloudRenderAnt != CloudRender /*|| ProceduralTexture.IsTextureUpdated()*/)
        {
            for (i = 0; i < MaximunClouds; i++)
            {
                MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                // Change the Material depending on the type defined by user
                AssignCloudMaterial(MyCloudParticle, CloudRender, TypeClouds);
            }
            TypeCloudsAnt  = TypeClouds;
            CloudRenderAnt = CloudRender;
        }
        // Actualize the velocity of the cloud and take care of the direccion of the mov for the LateUpdate proccess.
        if (MaximunVelocityAnt != MaximunVelocity || VelocityMultipierAnt != VelocityMultipier)
        {
            // Define the axis the clouds are moving on. (Only one value X or Y or Z, must be not equal Zero).
            // Used to determine the way the coulds are goig to dissapear when they move far away from the Box.
            if (MaximunVelocity.x > 0)
            {
                CloudsGenerateAxis = Axis.X;
            }
            else
            if (MaximunVelocity.x < 0)
            {
                CloudsGenerateAxis = Axis.XNeg;
            }
            else
            if (MaximunVelocity.y > 0)
            {
                CloudsGenerateAxis = Axis.Y;
            }
            else
            if (MaximunVelocity.y < 0)
            {
                CloudsGenerateAxis = Axis.YNeg;
            }
            else
            if (MaximunVelocity.z > 0)
            {
                CloudsGenerateAxis = Axis.Z;
            }
            else
            if (MaximunVelocity.z < 0)
            {
                CloudsGenerateAxis = Axis.ZNeg;
            }

            for (i = 0; i < MaximunClouds; i++)
            {
                ((CloudParticle)MyCloudsParticles[i]).SetCloudVelocity(MaximunVelocity, VelocityMultipier);
            }

            MaximunVelocityAnt   = MaximunVelocity;
            VelocityMultipierAnt = VelocityMultipier;
        }
        // All this just change one color or the system to colorize the cloud, just that.
        if (CloudColorAnt != CloudColor)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                ((CloudParticle)MyCloudsParticles[i]).SetMainColor(CloudColor);
            }
            CloudColorAnt = CloudColor;
        }

        if (MainColorAnt != MainColor)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                PaintTheParticlesShadows(((CloudParticle)MyCloudsParticles[i]));
            }
            MainColorAnt = MainColor;
        }

        if (SecondColorAnt != SecondColor || TintStrengthAnt != TintStrength)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                PaintTheParticlesShadows(((CloudParticle)MyCloudsParticles[i]));
            }
            SecondColorAnt  = SecondColor;
            TintStrengthAnt = TintStrength;
        }

        if (offsetAnt != offset)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                PaintTheParticlesShadows(((CloudParticle)MyCloudsParticles[i]));
            }
            offsetAnt = offset;
        }

        if (PaintTypeAnt != PaintType)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                PaintTheParticlesShadows(((CloudParticle)MyCloudsParticles[i]));
            }
            PaintTypeAnt = PaintType;
        }

        // Determine if cloud shadow must be active or not, depending on user choice
        if (NumberOfShadowsAnt != NumberOfShadows)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                ManageCloudShadow(MyCloudParticle);
            }
            NumberOfShadowsAnt = NumberOfShadows;
        }

        if (IsAnimate)
        {
            for (i = 0; i < NumberClouds; i++)
            {
                MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                MyCloudParticle.AnimateCloud(AnimationVelocity);
            }
        }
    }
Example #2
0
    // Only we manage the changes of variables in the inspector of Unity, not be used in gametime when
    // everything is setup.
    void Update()
    {
        CloudParticle MyCloudParticle;
        int i;

        // Create the procedural Texture Object of PT1 texture is selected in runtime.
        if(TypeClouds == Type.PT1 && !ProceduralTexture){
        GameObject PText1 = new GameObject();
        PText1.name = "CloudsToyPT1";
        PText1.transform.position =  Vector3.zero;
        PText1.transform.rotation =  Quaternion.identity;
        PText1.transform.parent = MyTransform;
        ProceduralTexture = (ProceduralCloudTexture)PText1.AddComponent ("ProceduralCloudTexture");
        PT1CopyInitialParameters();

        // Create the procedural materials to use in the clouds if PT1 had been selected.
        CloudsPTMatAdditive = new Material(Shader.Find("FX/CloudBright"));
        if(ProceduralTexture.IsInicialized())
            CloudsPTMatAdditive.mainTexture = ProceduralTexture.MyTexture;
        // Fourth type of Clouds. Procedural Blended textures
        CloudsPTMatBlended = new Material(Shader.Find("FX/CloudRealistic"));
        CloudsPTMatBlended.SetColor("_TintColor", CloudColor);
        if(ProceduralTexture.IsInicialized())
            CloudsPTMatBlended.mainTexture = ProceduralTexture.MyAlphaTexture;
        }

        // Trying to Assign a procedural txeture, once the texture is already created, not earlyer
        // PT1 needs time to be created and inicialized, that's why this code exits
        if(ProceduralTexture){
        if(ProceduralTexture.IsInicialized() && !bAssignProcTexture){
            // Procedural Additive textures
            CloudsPTMatAdditive.mainTexture = ProceduralTexture.MyTexture;
            // Procedural Blended textures
            CloudsPTMatBlended.SetColor("_TintColor", CloudColor);
            CloudsPTMatBlended.mainTexture = ProceduralTexture.MyAlphaTexture;

            if(TypeClouds == Type.PT1){
                for(i = 0; i < MaximunClouds; i++){
                    MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
                    if(i < NumberClouds){
                        MyCloudParticle.SetActive(true);
                        MyCloudParticle.UpdateCloudsPosition();
                        if(CloudRender == TypeRender.Realistic)
                            MyCloudParticle.SetMainColor(CloudColor);
                        PaintTheParticlesShadows(MyCloudParticle);
                    }
                }
            }
            bAssignProcTexture = true;
        }
        }

        // Change the number of visible clouds. Must activate the new particles and Update de position of the particles in the ellipse
        if(NumberCloudsAnt != NumberClouds){
        for(i = 0; i < MaximunClouds; i++){
            MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
            if(i < NumberClouds && !MyCloudParticle.IsActive()){
                MyCloudParticle.SetActive(true);
                MyCloudParticle.UpdateCloudsPosition();
                if(SoftClouds)
                    SoftCloudsAnt = !SoftClouds;
            }
            else
            if(i >= NumberClouds && MyCloudParticle.IsActive())
                MyCloudParticle.DesactivateRecursively();
        }
        NumberCloudsAnt = NumberClouds;
        }
        // Actualize the particle emmitter if the density of particles emmited has changed by user
        if(CloudDetailAnt != CloudDetail){
        if(CloudDetail == TypeDetail.Low){
            EmissionMult = 1;
            SizeFactorPart = 1;
        }
        else
        if(CloudDetail == TypeDetail.Normal){
            EmissionMult = 1.5f;
            SizeFactorPart = 1.2f;
        }
        else
        if(CloudDetail == TypeDetail.High){
            EmissionMult = 2.0f;
            SizeFactorPart = 1.3f;
        }
        for(i = 0; i < NumberClouds; i++){
            MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
            MyCloudParticle.SetCloudEmitter (i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
            MyCloudParticle.SetActive(true);
            MyCloudParticle.UpdateCloudsPosition();
            if(CloudRender == TypeRender.Realistic)
                MyCloudParticle.SetMainColor(CloudColor);
            PaintTheParticlesShadows(MyCloudParticle);
        }
        CloudDetailAnt = CloudDetail;
        }
        // if change the Size or amount of particles emmitted by any Cloud, must update the partice emmitter and emit again.
        // after that, we ensure the particles are in the assigned ellipsoid of the cloud
        if(SizeFactorPartAnt != SizeFactorPart || EmissionMultAnt != EmissionMult){
        for(i = 0; i < NumberClouds; i++){
            MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
            MyCloudParticle.SetCloudEmitter (i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
            MyCloudParticle.SetActive(true);
            MyCloudParticle.UpdateCloudsPosition();
        }
        SizeFactorPartAnt = SizeFactorPart;
        EmissionMultAnt = EmissionMult;
        }
        // Are soft clouds? Update the particle emmitter and renderer to take care of the change
        if(SoftCloudsAnt != SoftClouds){
        for(i = 0; i < NumberClouds; i++){
            MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
            MyCloudParticle.SetCloudEmitter (i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
            MyCloudParticle.SoftCloud (SoftClouds);
            MyCloudParticle.SetActive(true);
            MyCloudParticle.UpdateCloudsPosition();
        }
        SoftCloudsAnt = SoftClouds;
        }
        //  this two vars, only are visibles if softClouds are true, otherwise any change will not be advised
        if(SpreadDirAnt != SpreadDir || LengthSpreadAnt != LengthSpread){
        for(i = 0; i < NumberClouds; i++){
            MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
            MyCloudParticle.SetLengthScale(LengthSpread);
            if(SpreadDirAnt != SpreadDir){
                MyCloudParticle.SetWorldVelocity(SpreadDir);
                MyCloudParticle.SetActive(true);
                MyCloudParticle.UpdateCloudsPosition();
            }
        }
        SpreadDirAnt = SpreadDir;
        LengthSpreadAnt = LengthSpread;
        }
        // Changin the clouds width or tall. Must redefine all the cloud parameters, including his name
        if(MaxWithCloud != MaxWithCloudAnt || MaxTallCloud != MaxTallCloudAnt || MaxDepthCloud != MaxDepthCloudAnt){
        for(i = 0; i < NumberClouds; i++){
            MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
            // Define some main particle properties
            if( TypeClouds == Type.Nimbus1 || TypeClouds == Type.Nimbus2 ||
                TypeClouds == Type.Nimbus3 || TypeClouds == Type.Nimbus4 ||
                TypeClouds == Type.MixNimbus || TypeClouds == Type.MixAll || TypeClouds == Type.PT1)
                    MyCloudParticle.DefineCloudProperties (i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 0, FixedSize, true ,  true);
            else
            if(TypeClouds == Type.Cirrus1 || TypeClouds == Type.Cirrus2 || TypeClouds == Type.MixCirrus)
                    MyCloudParticle.DefineCloudProperties (i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 1, FixedSize, true ,  true);
            // Change the emitter params of the cloud to adjust the new size.
            MyCloudParticle.SetCloudEmitter (i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
            // Start emit again, my friend.
            MyCloudParticle.SetActive(true);
            //  Update the position of the particles emmitted inside the ellipsoid
            MyCloudParticle.UpdateCloudsPosition();
            // Colorize the cloud
            if(CloudRender == TypeRender.Realistic)
                MyCloudParticle.SetMainColor(CloudColor);
            PaintTheParticlesShadows(MyCloudParticle);
        }
        MaxWithCloudAnt = MaxWithCloud;
        MaxTallCloudAnt = MaxTallCloud;
        MaxDepthCloudAnt = MaxDepthCloud;
        }
        // If change the type of cloud just meaning i must change his material or render mode
        // also assign again the new texture if the procedural texture has changed.
        if(TypeCloudsAnt != TypeClouds || CloudRenderAnt != CloudRender /*|| ProceduralTexture.IsTextureUpdated()*/){
        for(i = 0; i < MaximunClouds; i++){
            MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
            // Change the Material depending on the type defined by user
            AssignCloudMaterial(MyCloudParticle, CloudRender, TypeClouds);
        }
        TypeCloudsAnt = TypeClouds;
        CloudRenderAnt = CloudRender;
        }
        // Actualize the velocity of the cloud and take care of the direccion of the mov for the LateUpdate proccess.
        if(MaximunVelocityAnt != MaximunVelocity || VelocityMultipierAnt != VelocityMultipier){
        // Define the axis the clouds are moving on. (Only one value X or Y or Z, must be not equal Zero).
        // Used to determine the way the coulds are goig to dissapear when they move far away from the Box.
        if(MaximunVelocity.x > 0)
            CloudsGenerateAxis = Axis.X;
        else
        if(MaximunVelocity.x < 0)
            CloudsGenerateAxis = Axis.XNeg;
        else
        if(MaximunVelocity.y > 0)
            CloudsGenerateAxis = Axis.Y;
        else
        if(MaximunVelocity.y < 0)
            CloudsGenerateAxis = Axis.YNeg;
        else
        if(MaximunVelocity.z > 0)
            CloudsGenerateAxis = Axis.Z;
        else
        if(MaximunVelocity.z < 0)
            CloudsGenerateAxis = Axis.ZNeg;

        for(i = 0; i < MaximunClouds; i++)
            ((CloudParticle)MyCloudsParticles[i]).SetCloudVelocity(MaximunVelocity, VelocityMultipier);

        MaximunVelocityAnt = MaximunVelocity;
        VelocityMultipierAnt = VelocityMultipier;
        }
        // All this just change one color or the system to colorize the cloud, just that.
        if(CloudColorAnt != CloudColor){
        for(i = 0; i < NumberClouds; i++)
            ((CloudParticle)MyCloudsParticles[i]).SetMainColor(CloudColor);
        CloudColorAnt = CloudColor;
        }

        if(MainColorAnt != MainColor){
        for(i = 0; i < NumberClouds; i++)
            PaintTheParticlesShadows(((CloudParticle)MyCloudsParticles[i]));
        MainColorAnt = MainColor;
        }

        if(SecondColorAnt != SecondColor || TintStrengthAnt !=TintStrength){
        for(i = 0; i < NumberClouds; i++)
            PaintTheParticlesShadows(((CloudParticle)MyCloudsParticles[i]));
        SecondColorAnt = SecondColor;
        TintStrengthAnt = TintStrength;
        }

        if(offsetAnt != offset){
        for(i = 0; i < NumberClouds; i++)
            PaintTheParticlesShadows(((CloudParticle)MyCloudsParticles[i]));
        offsetAnt = offset;
        }

        if(PaintTypeAnt != PaintType){
        for(i = 0; i < NumberClouds; i++)
            PaintTheParticlesShadows(((CloudParticle)MyCloudsParticles[i]));
        PaintTypeAnt = PaintType;
        }

        // Determine if cloud shadow must be active or not, depending on user choice
        if(NumberOfShadowsAnt != NumberOfShadows){
        for(i = 0; i < NumberClouds; i++){
            MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
            ManageCloudShadow(MyCloudParticle);
        }
        NumberOfShadowsAnt = NumberOfShadows;
        }

        if(IsAnimate)
        for(i = 0; i < NumberClouds; i++){
            MyCloudParticle = (CloudParticle)MyCloudsParticles[i];
            MyCloudParticle.AnimateCloud (AnimationVelocity);
        }
    }
Example #3
0
    void  Start()
    {
        MyTransform = this.transform;
        MyPosition  = transform.position;
        CloudParticle MyCloudParticle;
        Vector3       MyPos;
        Vector3       SideAux;
        int           i;

        //CloudPrefab = GameObject.Find("VolCloud Basic");
        //CloudPrefab = Resources.LoadAssetAtPath("Assets/Volumetric Clouds/Prefabs/VolCloud Basic.prefab", typeof(GameObject));
        CloudPresetAnt       = CloudPreset;
        CloudRenderAnt       = CloudRender;
        CloudDetailAnt       = CloudDetail;
        TypeCloudsAnt        = TypeClouds;
        EmissionMultAnt      = EmissionMult;
        SizeFactorPartAnt    = SizeFactorPart;
        SoftCloudsAnt        = SoftClouds;
        SpreadDirAnt         = SpreadDir;
        LengthSpreadAnt      = LengthSpread;
        NumberCloudsAnt      = NumberClouds;
        MaximunVelocityAnt   = MaximunVelocity;
        VelocityMultipierAnt = VelocityMultipier;
        PaintTypeAnt         = PaintType;
        CloudColorAnt        = CloudColor;
        MainColorAnt         = MainColor;
        SecondColorAnt       = SecondColor;
        TintStrengthAnt      = TintStrength;
        offsetAnt            = offset;
        NumberOfShadowsAnt   = NumberOfShadows;
        MaxWithCloudAnt      = MaxWithCloud;
        MaxTallCloudAnt      = MaxTallCloud;
        MaxDepthCloudAnt     = MaxDepthCloud;

        // Define the axis the clouds are moving on. (Only one value X or Y or Z, must be not equal Zero).
        Vector3 MyVelocity = MaximunVelocity;

        if (MyVelocity.x > 0)
        {
            CloudsGenerateAxis = Axis.X;
        }
        else
        if (MyVelocity.x < 0)
        {
            CloudsGenerateAxis = Axis.XNeg;
        }
        else
        if (MyVelocity.y > 0)
        {
            CloudsGenerateAxis = Axis.Y;
        }
        else
        if (MyVelocity.y < 0)
        {
            CloudsGenerateAxis = Axis.YNeg;
        }
        else
        if (MyVelocity.z > 0)
        {
            CloudsGenerateAxis = Axis.Z;
        }
        else
        if (MyVelocity.z < 0)
        {
            CloudsGenerateAxis = Axis.ZNeg;
        }

        // Create the procedural Texture Object only if it's selected in the clouds option in the editor.
        if (TypeClouds == Type.PT1)
        {
            GameObject PText1 = new GameObject();
            PText1.name = "CloudsToyPT1";
            PText1.transform.position = Vector3.zero;
            PText1.transform.rotation = Quaternion.identity;
            PText1.transform.parent   = MyTransform;
            ProceduralTexture         = (ProceduralCloudTexture)PText1.AddComponent("ProceduralCloudTexture");
            PT1CopyInitialParameters();
        }

        // Create the materials based in the textures provided by the user. maximun textures . 6
        // There are two types of materials Additive Soft for bright Clouds & Blend for more realistic ones.
        // First type of clouds. Additive - Bright Ones.
        for (i = 0; i < 6; i++)
        {
            CloudsMatAdditive[i]             = new Material(Shader.Find("FX/CloudBright"));
            CloudsMatAdditive[i].mainTexture = CloudsTextAdd[i];
        }
        // Second type of Clouds. Realistic Ones.
        for (i = 0; i < 6; i++)
        {
            CloudsMatBlended[i] = new Material(Shader.Find("FX/CloudRealistic"));
            CloudsMatBlended[i].SetColor("_TintColor", CloudColor);
            CloudsMatBlended[i].mainTexture = CloudsTextBlended[i];
        }

        // Tirdth type of Cloud. Procedural Additive texture, Created only if procedural texture had been selected
        if (ProceduralTexture)
        {
            CloudsPTMatAdditive = new Material(Shader.Find("FX/CloudBright"));
            if (ProceduralTexture.IsInicialized())
            {
                CloudsPTMatAdditive.mainTexture = ProceduralTexture.MyTexture;
            }
            // Fourth type of Cloud. Procedural Blended texture
            CloudsPTMatBlended = new Material(Shader.Find("FX/CloudRealistic"));
            CloudsPTMatBlended.SetColor("_TintColor", CloudColor);
            if (ProceduralTexture.IsInicialized())
            {
                CloudsPTMatBlended.mainTexture = ProceduralTexture.MyAlphaTexture;
            }
        }

        // Generate the clouds for first time, never well be destroyed during the scene.
        // Using a cubic shape to bounds the limits of coords. creation
        SideAux = Side / 2;
        for (i = 0; i < MaximunClouds; i++)
        {
            MyPos           = MyPosition;
            MyPos.x         = Random.Range(MyPos.x - SideAux.x, MyPos.x + SideAux.x);
            MyPos.y         = Random.Range(MyPos.y - SideAux.y, MyPos.y + SideAux.y);
            MyPos.z         = Random.Range(MyPos.z - SideAux.z, MyPos.z + SideAux.z);
            MyCloudParticle = new CloudParticle(MyPos, Quaternion.identity);
            MyCloudParticle.SetCloudParent(MyTransform);
            MyCloudsParticles.Add(MyCloudParticle);

            // Define some main particle properties
            if (TypeClouds == Type.Nimbus1 || TypeClouds == Type.Nimbus2 ||
                TypeClouds == Type.Nimbus3 || TypeClouds == Type.Nimbus4 ||
                TypeClouds == Type.MixNimbus || TypeClouds == Type.MixAll || TypeClouds == Type.PT1)
            {
                MyCloudParticle.DefineCloudProperties(i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 0, FixedSize, true, true);
            }
            else
            if (TypeClouds == Type.Cirrus1 || TypeClouds == Type.Cirrus2 || TypeClouds == Type.MixCirrus)
            {
                MyCloudParticle.DefineCloudProperties(i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 1, FixedSize, true, true);
            }

            AssignCloudMaterial(MyCloudParticle, CloudRender, TypeClouds);
            MyCloudParticle.SetCloudEmitter(i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
            MyCloudParticle.SetCloudVelocity(MaximunVelocity, VelocityMultipier);
            MyCloudParticle.SetLengthScale(LengthSpread);
            MyCloudParticle.SetWorldVelocity(SpreadDir);
            MyCloudParticle.SoftCloud(SoftClouds);
            ManageCloudShadow(MyCloudParticle);
            // If the cloud will be active, Paint the cloud otherwise deactivate it (they are initially active, but dont emit anything)
            if (i < NumberClouds)
            {
                if (TypeClouds != Type.PT1)
                {
                    MyCloudParticle.SetActive(true);             // Emit the particles, because this cloud is visible
                    MyCloudParticle.UpdateCloudsPosition();      // Updating the positions of particles once the Particle Emmitter emit them.
                    if (CloudRender == TypeRender.Realistic)
                    {
                        MyCloudParticle.SetMainColor(CloudColor);          // Set the main color of the cloud
                    }
                    PaintTheParticlesShadows(MyCloudParticle);             // Colorize the cloud with the Cloud Color and the Secondary Color
                }
            }
            else
            {
                MyCloudParticle.DesactivateRecursively();
            }
        }
    }
Example #4
0
    void Start()
    {
        MyTransform = this.transform;
        MyPosition = transform.position;
        CloudParticle MyCloudParticle;
        Vector3 MyPos;
        Vector3 SideAux;
        int i;

        //CloudPrefab = GameObject.Find("VolCloud Basic");
        //CloudPrefab = Resources.LoadAssetAtPath("Assets/Volumetric Clouds/Prefabs/VolCloud Basic.prefab", typeof(GameObject));
        CloudPresetAnt = CloudPreset;
        CloudRenderAnt = CloudRender;
        CloudDetailAnt = CloudDetail;
        TypeCloudsAnt = TypeClouds;
        EmissionMultAnt = EmissionMult;
        SizeFactorPartAnt = SizeFactorPart;
        SoftCloudsAnt = SoftClouds;
        SpreadDirAnt = SpreadDir;
        LengthSpreadAnt = LengthSpread;
        NumberCloudsAnt = NumberClouds;
        MaximunVelocityAnt = MaximunVelocity;
        VelocityMultipierAnt = VelocityMultipier;
        PaintTypeAnt = PaintType;
        CloudColorAnt = CloudColor;
        MainColorAnt = MainColor;
        SecondColorAnt = SecondColor;
        TintStrengthAnt = TintStrength;
        offsetAnt = offset;
        NumberOfShadowsAnt = NumberOfShadows;
        MaxWithCloudAnt = MaxWithCloud;
        MaxTallCloudAnt = MaxTallCloud;
        MaxDepthCloudAnt = MaxDepthCloud;

        // Define the axis the clouds are moving on. (Only one value X or Y or Z, must be not equal Zero).
        Vector3 MyVelocity = MaximunVelocity;
        if(MyVelocity.x > 0)
        CloudsGenerateAxis = Axis.X;
        else
        if(MyVelocity.x < 0)
        CloudsGenerateAxis = Axis.XNeg;
        else
        if(MyVelocity.y > 0)
        CloudsGenerateAxis = Axis.Y;
        else
        if(MyVelocity.y < 0)
        CloudsGenerateAxis = Axis.YNeg;
        else
        if(MyVelocity.z > 0)
        CloudsGenerateAxis = Axis.Z;
        else
        if(MyVelocity.z < 0)
        CloudsGenerateAxis = Axis.ZNeg;

        // Create the procedural Texture Object only if it's selected in the clouds option in the editor.
        if(TypeClouds == Type.PT1){
        GameObject PText1 = new GameObject();
        PText1.name = "CloudsToyPT1";
        PText1.transform.position =  Vector3.zero;
        PText1.transform.rotation =  Quaternion.identity;
        PText1.transform.parent = MyTransform;
        ProceduralTexture = (ProceduralCloudTexture)PText1.AddComponent ("ProceduralCloudTexture");
        PT1CopyInitialParameters();
        }

        // Create the materials based in the textures provided by the user. maximun textures . 6
        // There are two types of materials Additive Soft for bright Clouds & Blend for more realistic ones.
        // First type of clouds. Additive - Bright Ones.
        for(i = 0; i < 6; i++){
        CloudsMatAdditive[i] = new Material(Shader.Find("FX/CloudBright"));
        CloudsMatAdditive[i].mainTexture = CloudsTextAdd[i];
        }
        // Second type of Clouds. Realistic Ones.
        for(i = 0; i < 6; i++){
        CloudsMatBlended[i] = new Material(Shader.Find("FX/CloudRealistic"));
        CloudsMatBlended[i].SetColor("_TintColor", CloudColor);
        CloudsMatBlended[i].mainTexture = CloudsTextBlended[i];
        }

        // Tirdth type of Cloud. Procedural Additive texture, Created only if procedural texture had been selected
        if(ProceduralTexture){
        CloudsPTMatAdditive = new Material(Shader.Find("FX/CloudBright"));
        if(ProceduralTexture.IsInicialized())
            CloudsPTMatAdditive.mainTexture = ProceduralTexture.MyTexture;
        // Fourth type of Cloud. Procedural Blended texture
        CloudsPTMatBlended = new Material(Shader.Find("FX/CloudRealistic"));
        CloudsPTMatBlended.SetColor("_TintColor", CloudColor);
        if(ProceduralTexture.IsInicialized())
            CloudsPTMatBlended.mainTexture = ProceduralTexture.MyAlphaTexture;
        }

        // Generate the clouds for first time, never well be destroyed during the scene.
        // Using a cubic shape to bounds the limits of coords. creation
        SideAux =  Side/2;
        for(i = 0; i < MaximunClouds; i++){
        MyPos = MyPosition;
        MyPos.x = Random.Range (MyPos.x-SideAux.x, MyPos.x+SideAux.x);
        MyPos.y = Random.Range (MyPos.y-SideAux.y, MyPos.y+SideAux.y);
        MyPos.z = Random.Range (MyPos.z-SideAux.z, MyPos.z+SideAux.z);
        MyCloudParticle = new CloudParticle(MyPos, Quaternion.identity);
        MyCloudParticle.SetCloudParent(MyTransform);
        MyCloudsParticles.Add(MyCloudParticle);

        // Define some main particle properties
        if( TypeClouds == Type.Nimbus1 || TypeClouds == Type.Nimbus2 ||
            TypeClouds == Type.Nimbus3 || TypeClouds == Type.Nimbus4 ||
            TypeClouds == Type.MixNimbus || TypeClouds == Type.MixAll || TypeClouds == Type.PT1)
                MyCloudParticle.DefineCloudProperties (i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 0, FixedSize, true ,  true);
        else
        if(TypeClouds == Type.Cirrus1 || TypeClouds == Type.Cirrus2 || TypeClouds == Type.MixCirrus)
                MyCloudParticle.DefineCloudProperties (i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 1, FixedSize, true ,  true);

        AssignCloudMaterial (MyCloudParticle,  CloudRender ,  TypeClouds);
        MyCloudParticle.SetCloudEmitter (i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
        MyCloudParticle.SetCloudVelocity (MaximunVelocity, VelocityMultipier);
        MyCloudParticle.SetLengthScale(LengthSpread);
        MyCloudParticle.SetWorldVelocity(SpreadDir);
        MyCloudParticle.SoftCloud(SoftClouds);
        ManageCloudShadow(MyCloudParticle);
        // If the cloud will be active, Paint the cloud otherwise deactivate it (they are initially active, but dont emit anything)
        if(i < NumberClouds){
            if(TypeClouds != Type.PT1){
                MyCloudParticle.SetActive(true); // Emit the particles, because this cloud is visible
                MyCloudParticle.UpdateCloudsPosition(); // Updating the positions of particles once the Particle Emmitter emit them.
                if(CloudRender == TypeRender.Realistic)
                    MyCloudParticle.SetMainColor(CloudColor);  // Set the main color of the cloud
                PaintTheParticlesShadows(MyCloudParticle); // Colorize the cloud with the Cloud Color and the Secondary Color
            }
        }
        else
            MyCloudParticle.DesactivateRecursively();
        }
    }
    public override void OnInspectorGUI()
    {
        //EditorGUIUtility.LookLikeInspector();
        EditorGUIUtility.LookLikeControls();

        CloudSystem = (CloudsToy)target;
        if (!CloudSystem.gameObject)
        {
            return;                                                       // If there isn't any cloudstoy gameobject in your scene, just return and do nothing at all.
        }
        ProcText = (ProceduralCloudTexture)CloudSystem.ProceduralTexture; // Get the pointer to the ProceduralTexture object

        // Definition of a red foldout (how it will looks like)
        redFoldoutStyle = new GUIStyle(EditorStyles.foldout);
        redFoldoutStyle.normal.textColor  = Color.red;
        redFoldoutStyle.focused.textColor = Color.red;
        redFoldoutStyle.hover.textColor   = Color.red;
        redFoldoutStyle.active.textColor  = Color.red;

        myColor = GUI.color;         // Get the Current(default) GUI Color.

        // Update the serializedProperty - always do this in the beginning of OnInspectorGUI.
        serializedObject.Update();

        // Starts Drawing
        EditorGUILayout.BeginVertical();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        string[] MenuOptions = new string[] { "    Clouds    ", "Proc Texture" };
        toolbarOptions = GUILayout.Toolbar(toolbarOptions, MenuOptions);
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginVertical();
        switch (toolbarOptions)
        {
        case 0:
            // Is the CloudsToy being executed in Unity? If not, show the Maximun Clouds parameter.
            GUIContent contentFoldout = new GUIContent(" Maximun Clouds (DO NOT change while executing)", "Set the maximun clouds number that" +
                                                       "the CloudsToy system will handle. Changing this variable in runtime will crash the application.");
            if (!ProcText)
            {
                GUI.color         = Color.red;
                showMaximumClouds = EditorGUILayout.Foldout(showMaximumClouds, contentFoldout, redFoldoutStyle);
                if (showMaximumClouds)
                {
                    EditorGUILayout.PropertyField(maximunClouds, new GUIContent(" "));
                }
                GUI.color = myColor;

                if (GUI.changed)
                {
                    EditorUtility.SetDirty(target);
                    GUI.changed = false;
                }
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
            }

            GUIContent contentCloud = new GUIContent("  Cloud Presets: ", "Cloud pressets to quickly start configuring the clouds style");
            GUI.changed = false;
            EditorGUILayout.PropertyField(cloudPreset, contentCloud);
            if (GUI.changed)
            {
                switch (cloudPreset.enumValueIndex)
                {
                case (int)CloudsToy.TypePreset.Stormy:
                    CloudSystem.SetPresetStormy();
                    break;

                case (int)CloudsToy.TypePreset.Sunrise:
                    CloudSystem.SetPresetSunrise();
                    break;

                case (int)CloudsToy.TypePreset.Fantasy:
                    CloudSystem.SetPresetFantasy();
                    break;
                }
                EditorUtility.SetDirty(target);
                //GUI.changed = false;
                return;
            }

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            contentCloud = new GUIContent("  Cloud Render: ", "Assign the shader that will be used to render the clouds particles.");
            EditorGUILayout.PropertyField(cloudRender, contentCloud);
            contentCloud = new GUIContent("  Cloud Type: ", "Assign the texture that will be used to draw the clouds.");
            EditorGUILayout.PropertyField(typeClouds, contentCloud);
            contentCloud = new GUIContent("  Cloud Detail: ", "Cloud complexity that will created more populated clouds. " +
                                          "Be aware that higher levels can drop your FPS drasticaly if there are a lot of clouds.");
            EditorGUILayout.PropertyField(CloudDetail, contentCloud);
            if (GUI.changed)
            {
                CloudSystem.SetCloudDetailParams();
                EditorUtility.SetDirty(target);
            }
            GUI.changed = false;
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            GUI.color      = Color.red;
            contentFoldout = new GUIContent(" Particles Shader Settings", "You can change the shaders used in the clouds." +
                                            "It can be used, for example, to use different shaders in mobile applications.");
            showShaderSettings = EditorGUILayout.Foldout(showShaderSettings, contentFoldout, redFoldoutStyle);
            if (showShaderSettings)
            {
                EditorGUILayout.Separator();
                contentCloud = new GUIContent("Realistic Cloud Shader:", "Shader that will be used when selecting Realistic Clouds. This shader will use" +
                                              "the blended textures that can be assigned in the CloudsToy Texture paragraph. It is an alpha blended shader.");
                EditorGUILayout.PropertyField(realisticShader, contentCloud);
                contentCloud = new GUIContent("Bright Cloud Shader:", "Shader that will be used when selecting Bright Clouds. This shader will use" +
                                              "the add textures that can be assigned in the CloudsToy Texture paragraph. It is an alpha additive shader.");
                EditorGUILayout.PropertyField(brightShader, contentCloud);
                contentCloud = new GUIContent("Projector Material:", "The projector material will be used to create the clouds shadows. " +
                                              "By default it is usedthe Unity's default projector material.");
                EditorGUILayout.PropertyField(projectorMaterial, contentCloud);
                EditorGUILayout.Separator();
            }
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            contentFoldout = new GUIContent(" Particles Advanced Settings", "This section provides of two parameters to tweak your clouds. " +
                                            "It will be applied to all the cloud system. Those values can make your FPS drop drastically is you select very high values. Take it into account!");
            showAdvancedSettings = EditorGUILayout.Foldout(showAdvancedSettings, contentFoldout, redFoldoutStyle);
            if (showAdvancedSettings)
            {
                EditorGUILayout.Separator();
                contentCloud = new GUIContent("  Position Checker Time: ", "The time period to check the cloud position.");
                positionCheckerTime.floatValue = EditorGUILayout.Slider(contentCloud, positionCheckerTime.floatValue, 0f, 2.0f);
                contentCloud = new GUIContent("  Size Factor: ", "Modify the initial ellipsoid from wich the cloud particle is generated, so smaller (or bigger) clouds will be created.");
                sizeFactorPart.floatValue = EditorGUILayout.Slider(contentCloud, sizeFactorPart.floatValue, 0.1f, 4.0f);
                contentCloud            = new GUIContent("  Emitter Mult: ", "Modify the minimun/maximun emission particle cloud, so more (or less) populated clouds will be created.");
                emissionMult.floatValue = EditorGUILayout.Slider(contentCloud, emissionMult.floatValue, 0.1f, 4.0f);
                EditorGUILayout.Separator();
            }
            GUI.color = myColor;
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            Rect buttonRect = EditorGUILayout.BeginHorizontal();
            buttonRect.x      = buttonRect.width / 2 - 100;
            buttonRect.width  = 200;
            buttonRect.height = 30;

            GUI.color    = Color.red;
            contentCloud = new GUIContent("Repaint Clouds", "Unity scene cloud regeneration and repainting. Use it when you want to be sure that all your tweaked adjustments are being applied to your clouds in the scene." +
                                          "It's ment to be used only in Unity while adjusting your clouds. DO NOT USE IT in your game in realtime execution; you will be recreating your clouds in your game just for nothing.");
            if (GUI.Button(buttonRect, contentCloud))
            {
                CloudSystem.EditorRepaintClouds();
            }
            GUI.color = myColor;

            EditorGUILayout.Separator();
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            contentCloud = new GUIContent("  Soft Clouds", "Modify particle render to stretch mode instead of the regular billboard mode.");
            EditorGUILayout.PropertyField(softClouds, contentCloud);
            if (softClouds.boolValue)
            {
                contentCloud = new GUIContent("  Spread Direction: ", "The world particle velocity that will be applied to the stretched clouds particles.");
                EditorGUILayout.PropertyField(spreadDir, contentCloud);
                contentCloud            = new GUIContent("  Length Spread: ", "The scale lenght to which the clouds will be stretched to.");
                lengthSpread.floatValue = EditorGUILayout.Slider(contentCloud, lengthSpread.floatValue, 1.0f, 30.0f);
            }
            EditorGUILayout.Separator();
            contentCloud = new GUIContent("  Clouds Num: ", "Number of clouds that will be created. The maximum number of clouds that CloudsToy will handle" +
                                          "can be configured in the Maximum clouds parameter, the first cloudsToy parameter");
            numberClouds.intValue = EditorGUILayout.IntSlider(contentCloud, numberClouds.intValue, 1, maximunClouds.intValue);
            EditorGUILayout.Separator();
            contentCloud = new GUIContent("  Cloud Creation Size: ", "The scene blue box size where the clouds will be created into initially.");
            EditorGUILayout.PropertyField(side, contentCloud);
            contentCloud = new GUIContent("  Dissapear Mult: ", "The scene yellow box will be calculated as a multiplier of the blue box. It is used" +
                                          "to know when to remove a cloud. So, when clouds are moving in any direction, as soon as they reach the yellow box border, they will be moved to the other side of the box");
            dissapearMultiplier.floatValue = EditorGUILayout.Slider(contentCloud, dissapearMultiplier.floatValue, 1.0f, 10.0f);
            EditorGUILayout.Separator();
            contentCloud = new GUIContent("  Maximum Velocity: ", "The clouds maximum velocity. Bigger clouds will be slower than the smaller ones.");
            EditorGUILayout.PropertyField(maximunVelocity, contentCloud);
            contentCloud = new GUIContent("  Velocity Mult: ", "A velocity multiplier to quickly tweak the clouds velocity without modifying the previous parameter.");
            velocityMultipier.floatValue = EditorGUILayout.Slider(contentCloud, velocityMultipier.floatValue, 0.01f, 20.0f);
            EditorGUILayout.Separator();
            contentCloud = new GUIContent("  Paint Type: ", "The clouds can be colorized with different adjustable colors using two diferent presets. Below paint type will be try to change the color of the" +
                                          "lower cloud particles to simulate how real clouds look like.");
            EditorGUILayout.PropertyField(paintType, contentCloud);
            contentCloud = new GUIContent("  Cloud Color: ", "Main cloud color used only in Realistic render mode. This color" +
                                          "will be directly assigned to the cloud realistic shader Tint color used by realistic particle clouds.");
            EditorGUILayout.PropertyField(cloudColor, contentCloud);
            contentCloud = new GUIContent("  Main Color: ", "This is the main color used when trying colorize the cloud.");
            EditorGUILayout.PropertyField(mainColor, contentCloud);
            contentCloud = new GUIContent("  Secondary Color: ", "This is the second color used when trying colorize the cloud.");
            EditorGUILayout.PropertyField(secondColor, contentCloud);
            contentCloud          = new GUIContent("  Tint Strength: ", "Higher strenth will tint more cloud particles in the cloud.");
            tintStrength.intValue = EditorGUILayout.IntSlider(contentCloud, tintStrength.intValue, 1, 100);
            if (paintType.enumValueIndex == (int)CloudsToy.TypePaintDistr.Below)
            {
                contentCloud = new GUIContent("  Offset: ", "Will be used in the below paint type to tint the cloud particles depending on" +
                                              "their relative position inside the cloud. Higher values will paint particles that are in high local positions inside the cloud");
                offset.floatValue = EditorGUILayout.Slider(contentCloud, offset.floatValue, 0.0f, 1.0f);
            }
            EditorGUILayout.Separator();
            contentCloud           = new GUIContent("  Width: ", "Maximum width of each cloud");
            maxWithCloud.intValue  = EditorGUILayout.IntSlider(contentCloud, maxWithCloud.intValue, 10, 1000);
            contentCloud           = new GUIContent("  Height: ", "Maximum height of each cloud");
            maxTallCloud.intValue  = EditorGUILayout.IntSlider(contentCloud, maxTallCloud.intValue, 5, 500);
            contentCloud           = new GUIContent("  Depth: ", "Maximum depth of each cloud");
            maxDepthCloud.intValue = EditorGUILayout.IntSlider(contentCloud, maxDepthCloud.intValue, 5, 1000);
            contentCloud           = new GUIContent("  Fixed Size", "The size of the clouds will be exactly the same depending on their cloud" +
                                                    "size type (big, medium, small). If fixed size is disabled all the big clouds (for example) will not have the exact same size");
            EditorGUILayout.PropertyField(fixedSize, contentCloud);
            EditorGUILayout.Separator();
            contentCloud = new GUIContent("  Animate Cloud", "Each cloud can be animated making it to rotate over itself.");
            EditorGUILayout.PropertyField(isAnimate, contentCloud);
            if (isAnimate.boolValue)
            {
                contentCloud = new GUIContent("  Animation Velocity: ", "Cloud rotation velocity.");
                animationVelocity.floatValue = EditorGUILayout.Slider(contentCloud, animationVelocity.floatValue, 0.0f, 1.0f);
            }
            contentCloud = new GUIContent("  Shadows: ", "Clouds can have a shadow. It is made using a Unity's projector that creates a shadow" +
                                          "taking into account the layer the clouds are in (so they will ignore the cloud particle itself when drawing their own shadow");
            EditorGUILayout.PropertyField(numberOfShadows, contentCloud);
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            contentFoldout = new GUIContent(" CloudsToy Textures", "This section show all textures used in cloudstoy to generate clouds");
            showTextures   = EditorGUILayout.Foldout(showTextures, contentFoldout);

            if (showTextures)
            {
                GUI.color    = Color.green;
                contentCloud = new GUIContent("  Texture Size", " ");
                textDrawSize = EditorGUILayout.IntSlider(contentCloud, textDrawSize, 60, 90);
                GUI.color    = myColor;

                EditorGUILayout.Separator();
                EditorGUILayout.Separator();

                contentCloud = new GUIContent("  Texture Add", "These are the textures that will be used by bright type clouds. Bright clouds " +
                                              "use a particle additive kind of shader.");
                GUIContent contentCloud2 = new GUIContent("(Used for Bright Clouds)", "");
                EditorGUILayout.LabelField(contentCloud, contentCloud2);



                EditorGUILayout.BeginHorizontal();
                for (i = 0; i < cloudsTextAdd.arraySize; i++)
                {
                    if (i == cloudsTextAdd.arraySize * 0.5f)
                    {
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Separator();
                        EditorGUILayout.BeginHorizontal();
                    }
                    else
                    if (i != 0 && i != 3)
                    {
                        EditorGUILayout.Separator();
                    }

                    contentCloud = new GUIContent("", "");
                    cloudsTextAdd.GetArrayElementAtIndex(i).objectReferenceValue = (Texture2D)EditorGUILayout.ObjectField(cloudsTextAdd.GetArrayElementAtIndex(i).objectReferenceValue, typeof(Texture2D), false, GUILayout.Width(textDrawSize), GUILayout.Height(textDrawSize));
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();

                contentCloud = new GUIContent("  Texture Blended", "These are the textures that will be used by realistic type clouds. Bright clouds " +
                                              "use a particle blended additive kind of shader.");
                contentCloud2 = new GUIContent("(Used for Realistic Clouds)", "");
                EditorGUILayout.LabelField(contentCloud, contentCloud2);
                EditorGUILayout.BeginHorizontal();
                for (i = 0; i < cloudsTextBlended.arraySize; i++)
                {
                    if (i == cloudsTextBlended.arraySize * 0.5f)
                    {
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Separator();
                        EditorGUILayout.BeginHorizontal();
                    }
                    else
                    if (i != 0 && i != 3)
                    {
                        EditorGUILayout.Separator();
                    }

                    contentCloud = new GUIContent("", "");
                    cloudsTextBlended.GetArrayElementAtIndex(i).objectReferenceValue = (Texture2D)EditorGUILayout.ObjectField(cloudsTextBlended.GetArrayElementAtIndex(i).objectReferenceValue, typeof(Texture2D), false, GUILayout.Width(textDrawSize), GUILayout.Height(textDrawSize));
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Separator();
            }

            EditorGUILayout.Separator();
            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
            GUI.changed = false;
            break;


        case 1:
            if (!ProcText)
            {
                GUI.color    = Color.red;
                contentCloud = new GUIContent("  Texture Width: ", "Texture width used to create the runtime noise based texture. Because the texture is generated at runtime, " +
                                              "big texture sizes will slow the process. The texture is generated pixel by pixel so an 256x256 texture will be FOUR TIMES SLOWER than a 128x128 texture");
                EditorGUILayout.PropertyField(PT1TextureWidth, contentCloud);
                contentCloud = new GUIContent("  Texture Height: ", "Texture height used to create the runtime noise based texture. Because the texture is generated at runtime, " +
                                              "big texture sizes will slow the process. The texture is generated pixel by pixel so an 256x256 texture will be FOUR TIMES SLOWER than a 128x128 texture");
                EditorGUILayout.PropertyField(PT1TextureHeight, contentCloud);
                if (GUI.changed && ProcText)
                {
                    EditorUtility.SetDirty(target);
                }
                GUI.color = myColor;
            }
            GUI.changed = false;
            EditorGUILayout.Separator();
            contentCloud = new GUIContent("  Type of Noise: ", "There are two different noise generator algorithms: The standard noise generation (Cloud) and the usual perlin noise generator.");
            EditorGUILayout.PropertyField(PT1TypeNoise, contentCloud);
            EditorGUILayout.Separator();
            contentCloud     = new GUIContent("  Seed: ", "This value is the basic seed value to generate any ramdom noise Diferent values will generate different noise patterns.");
            PT1Seed.intValue = EditorGUILayout.IntSlider(contentCloud, PT1Seed.intValue, 1, 10000);
            EditorGUILayout.Separator();
            if (GUI.changed && ProcText)
            {
                CloudSystem.PT1NewRandomSeed();
                EditorUtility.SetDirty(target);
            }
            GUI.changed = false;

            contentCloud              = new GUIContent("  Scale Width: ", "Internal noise scale width used when generating the noise pattern.");
            PT1ScaleWidth.floatValue  = EditorGUILayout.Slider(contentCloud, PT1ScaleWidth.floatValue, 0.1f, 50.0f);
            contentCloud              = new GUIContent("  Scale Height: ", "Internal noise scale height used when generating the noise pattern.");
            PT1ScaleHeight.floatValue = EditorGUILayout.Slider(contentCloud, PT1ScaleHeight.floatValue, 0.1f, 50.0f);
            contentCloud              = new GUIContent("  Scale Factor: ", "Scale multiplier used to quickly tweak the scale width/height at once.");
            PT1ScaleFactor.floatValue = EditorGUILayout.Slider(contentCloud, PT1ScaleFactor.floatValue, 0.1f, 2.0f);
            EditorGUILayout.Separator();

            switch (PT1TypeNoise.enumValueIndex)
            {
            case (int)CloudsToy.NoisePresetPT1.Cloud:
                contentCloud = new GUIContent("  Turb Size: ", "Turbulence parameter used by SimpleNoise Turbulence generator. Internally, this is the octaves parameter" +
                                              "used to calculate the turbulence of an already created SimpleNoise texture.");
                PT1TurbSize.intValue = EditorGUILayout.IntSlider(contentCloud, PT1TurbSize.intValue, 1, 256);
                contentCloud         = new GUIContent("  Turb Lacun: ", "Lacunarity parameter used by SimpleNoise Turbulence generator. Internally, this is the lacunarity parameter" +
                                                      "used to calculate the turbulence of an already created SimpleNoise texture.");
                PT1TurbLacun.floatValue = EditorGUILayout.Slider(contentCloud, PT1TurbLacun.floatValue, 0.01f, 0.99f);
                contentCloud            = new GUIContent("  Turb Gain: ", "Gain parameter used by SimpleNoise Turbulence generator. Internally, this is the gain parameter" +
                                                         "used to calculate the turbulence of an already created SimpleNoise texture. Higher values will generate brighter textures.");
                PT1TurbGain.floatValue = EditorGUILayout.Slider(contentCloud, PT1TurbGain.floatValue, 0.01f, 2.99f);
                contentCloud           = new GUIContent("  Radius: ", "Used to adjust the noise turbulence. Lower values will generate darker textures because the resulting texture" +
                                                        "will dark the pixels outside that radious.");
                PT1xyPeriod.floatValue = EditorGUILayout.Slider(contentCloud, PT1xyPeriod.floatValue, 0.1f, 2.0f);
                contentCloud           = new GUIContent("  Turb Power: ", "Turbulence multipler that will affect the pixels inside the turbulence radious. " +
                                                        "Higher values will generate brighter results BUT it will only affect the pixels inside a given Radious.");
                PT1turbPower.floatValue = EditorGUILayout.Slider(contentCloud, PT1turbPower.floatValue, 1.0f, 60.0f);
                break;

            case (int)CloudsToy.NoisePresetPT1.PerlinCloud:
                contentCloud                   = new GUIContent("  Lacunarity: ", "Lacunarity parameter used by Perlin noise generator.");
                PT1Lacunarity.floatValue       = EditorGUILayout.Slider(contentCloud, PT1Lacunarity.floatValue, 0.0f, 10.0f);
                contentCloud                   = new GUIContent("  FractalIncrement: ", "FractalIncrement parameter used by Perlin noise generator.");
                PT1FractalIncrement.floatValue = EditorGUILayout.Slider(contentCloud, PT1FractalIncrement.floatValue, 0.0f, 2.0f);
                contentCloud                   = new GUIContent("  Octaves: ", "Octave parameter used by Perlin noise generator.");
                PT1Octaves.floatValue          = EditorGUILayout.Slider(contentCloud, PT1Octaves.floatValue, 0.0f, 10.0f);
                contentCloud                   = new GUIContent("  Offset: ", "Offset parameter used by Perlin noise generator (HybridMultifractal noise functions).");
                PT1Offset.floatValue           = EditorGUILayout.Slider(contentCloud, PT1Offset.floatValue, 0.1f, 3.0f);
                break;
            }
            EditorGUILayout.Separator();

            /*CloudSystem.PT1IsHalo = EditorGUILayout.Toggle("  Halo Active:", CloudSystem.PT1IsHalo);
             * if(CloudSystem.PT1IsHalo)*/
            contentCloud                   = new GUIContent("  HaloEffect: ", "Will create a dark halo around the texture, used to make rounded textures that can be used to draw the clouds.");
            PT1HaloEffect.floatValue       = EditorGUILayout.Slider(contentCloud, PT1HaloEffect.floatValue, 0.1f, 1.7f);
            contentCloud                   = new GUIContent("  Inside Radius: ", "Will dark the pixels inside the Halo, used to teawk rounded textures that can be used to draw the clouds.");
            PT1HaloInsideRadius.floatValue = EditorGUILayout.Slider(contentCloud, PT1HaloInsideRadius.floatValue, 0.1f, 3.5f);
            EditorGUILayout.Separator();

            /*CloudSystem.PT1BackgroundColor = EditorGUILayout.ColorField("  Back Color: ", CloudSystem.PT1BackgroundColor);
             * CloudSystem.PT1FinalColor = EditorGUILayout.ColorField("  Front Color: ", CloudSystem.PT1FinalColor);*/
            contentCloud = new GUIContent("  Invert Colors:", "Invert the texture colors.");
            EditorGUILayout.PropertyField(PT1InvertColors, contentCloud);
            contentCloud = new GUIContent("  Contrast Mult: ", "Higher values will create brighter textures.");
            PT1ContrastMult.floatValue = EditorGUILayout.Slider(contentCloud, PT1ContrastMult.floatValue, 0.0f, 2.0f);
            EditorGUILayout.Separator();
            contentCloud = new GUIContent("  Alpha Texture:", "It will create a second texture with transparency so the alpha channel can be tweaked." +
                                          "This new alpha texture will be draw in the inspector so you can see the alpha channel (the alpha values will be shown in green color.");
            EditorGUILayout.PropertyField(PT1UseAlphaTexture, contentCloud);
            if (PT1UseAlphaTexture.boolValue)
            {
                contentCloud             = new GUIContent("  Alpha Index: ", "This value 0-1 will be used to increase/decrease the texture's alpha channel.");
                PT1AlphaIndex.floatValue = EditorGUILayout.Slider(contentCloud, PT1AlphaIndex.floatValue, 0.0f, 1.0f);
            }
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            // Be sure that the Texture1 class exists before try to paint the textures.
            if (ProcText)
            {
                contentCloud = new GUIContent("  InEditor Text Size ", "Texture size used only in the inspector window.");
                MyWidth      = EditorGUILayout.IntSlider(contentCloud, MyWidth, 50, 105);
                EditorGUILayout.Separator();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.Space();
                ProcText.MyTexture = (Texture2D)EditorGUILayout.ObjectField(ProcText.MyTexture, typeof(Texture2D), false, GUILayout.Width(MyWidth), GUILayout.Height(MyWidth));
                EditorGUILayout.Separator();
                EditorGUILayout.Space();
                if (CloudSystem.PT1UseAlphaTexture)
                {
                    ProcText.MyAlphaDrawTexture = (Texture2D)EditorGUILayout.ObjectField(ProcText.MyAlphaDrawTexture, typeof(Texture2D), false, GUILayout.Width(MyWidth), GUILayout.Height(MyWidth));
                }
                EditorGUILayout.Separator();
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
            }

            Rect buttonRectPT1 = EditorGUILayout.BeginHorizontal();
            buttonRectPT1.x      = buttonRectPT1.width / 2 - 100;
            buttonRectPT1.width  = 200;
            buttonRectPT1.height = 30;

            GUI.color    = Color.red;
            contentCloud = new GUIContent("Reset Parameters", "Reset the noise parameters to their default values.");
            if (GUI.Button(buttonRectPT1, contentCloud))
            {
                CloudSystem.ResetCloudParameters();
                if (ProcText)
                {
                    CloudSystem.PT1CopyParameters();
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            // Is the program being executed? If so, show the 'Save Params' button.
            GUI.color = Color.yellow;
            if (ProcText)
            {
                Rect buttonRectPrint = EditorGUILayout.BeginHorizontal();
                buttonRectPrint.x      = buttonRectPrint.width * 0.5f - 100;
                buttonRectPrint.width  = 200;
                buttonRectPrint.height = 30;

                contentCloud = new GUIContent("Save Texture", "Save the generated texture to a file. CAUTION: This funcion can not be used in Web Player targeted projects.");
                if (GUI.Button(buttonRectPrint, contentCloud))
                {
                    CloudSystem.SaveProceduralTexture();
                }
                EditorGUILayout.EndHorizontal();
            }

            GUI.color = myColor;
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            if (GUI.changed)
            {
                if (ProcText)
                {
                    CloudSystem.PT1CopyParameters();
                    CloudSystem.ModifyPTMaterials();
                }
                EditorUtility.SetDirty(target);
            }
            GUI.changed = false;

            break;
        }
        EditorGUILayout.EndVertical();

        // Apply changes to the serializedProperty - always do this in the end of OnInspectorGUI.
        serializedObject.ApplyModifiedProperties();
    }
    public override void OnInspectorGUI() {
		//EditorGUIUtility.LookLikeInspector();
		EditorGUIUtility.LookLikeControls();
		CloudSystem = (CloudsToy) target;
		if (!CloudSystem.gameObject) {
			return;
		}
		
		ProcText = (ProceduralCloudTexture) CloudSystem.ProceduralTexture;

		EditorGUILayout.BeginVertical();
		EditorGUILayout.Separator();
		EditorGUILayout.Separator();
		string[] MenuOptions = new string[2];
		MenuOptions[0] = "    Clouds    ";
		MenuOptions[1] = "Proc Texture";
		CloudSystem.ToolbarOptions = GUILayout.Toolbar(CloudSystem.ToolbarOptions, MenuOptions);
		EditorGUILayout.Separator();
		EditorGUILayout.Separator();
		EditorGUILayout.Separator();
		EditorGUILayout.BeginVertical();
		switch (CloudSystem.ToolbarOptions) {
			
			
		case 0: 
			// Is the CloudsToy being executed in Unity? If not, show the Maximun Clouds parameter.
			if(!ProcText){
				showMaximunClouds = EditorGUILayout.Foldout(showMaximunClouds, " Maximun Clouds (DO NOT change while executing)");
				if(showMaximunClouds)
					CloudSystem.MaximunClouds = EditorGUILayout.IntField("  ", CloudSystem.MaximunClouds);
					if (GUI.changed)
						EditorUtility.SetDirty(CloudSystem);
				GUI.changed = false;
				EditorGUILayout.Separator();
				EditorGUILayout.Separator();
			}
			CloudSystem.CloudPreset = (CloudsToy.TypePreset)EditorGUILayout.EnumPopup("  Cloud Presets: ", CloudSystem.CloudPreset);
			if (GUI.changed) {
				if(CloudSystem.CloudPreset == CloudsToy.TypePreset.Stormy)
					CloudSystem.SetPresetStormy();
				else
				if(CloudSystem.CloudPreset == CloudsToy.TypePreset.Sunrise)
					CloudSystem.SetPresetSunrise();
				else
				if(CloudSystem.CloudPreset == CloudsToy.TypePreset.Fantasy)
					CloudSystem.SetPresetFantasy();
				EditorUtility.SetDirty(CloudSystem);
			}
			GUI.changed = false;
			
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			CloudSystem.CloudRender = (CloudsToy.TypeRender)EditorGUILayout.EnumPopup("  Cloud Render: ", CloudSystem.CloudRender);
			CloudSystem.TypeClouds = (CloudsToy.Type)EditorGUILayout.EnumPopup("  Cloud Type: ", CloudSystem.TypeClouds);
			CloudSystem.CloudDetail = (CloudsToy.TypeDetail)EditorGUILayout.EnumPopup("  Cloud Detail: ", CloudSystem.CloudDetail);
			if (GUI.changed) {
				CloudSystem.SetCloudDetailParams();
				EditorUtility.SetDirty(CloudSystem);
			}
			GUI.changed = false;
				
			showAdvancedSettings = EditorGUILayout.Foldout(showAdvancedSettings, "Particles Advanced Settings");
			if(showAdvancedSettings){
				EditorGUILayout.Separator();
				CloudSystem.SizeFactorPart = EditorGUILayout.Slider("  Size Factor: ", CloudSystem.SizeFactorPart, 0.1f, 4.0f);
				CloudSystem.EmissionMult = EditorGUILayout.Slider("  Emitter Mult: ", CloudSystem.EmissionMult, 0.1f, 4.0f);
				EditorGUILayout.Separator();
			}
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			Rect buttonRect = EditorGUILayout.BeginHorizontal();
			buttonRect.x = buttonRect.width / 2 - 100;
			buttonRect.width = 200;
			buttonRect.height = 30;
			//GUI.skin??
			if(GUI.Button(buttonRect, "Repaint Clouds")){
				CloudSystem.EditorRepaintClouds();
			}
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			CloudSystem.SoftClouds = EditorGUILayout.Toggle("  Soft Clouds", CloudSystem.SoftClouds);
			if(CloudSystem.SoftClouds){
				CloudSystem.SpreadDir = EditorGUILayout.Vector3Field("  Spread Direction: ", CloudSystem.SpreadDir);
				CloudSystem.LengthSpread = EditorGUILayout.Slider("  Length Spread: ", CloudSystem.LengthSpread, 1, 30);
			}
			EditorGUILayout.Separator();
			CloudSystem.NumberClouds = EditorGUILayout.IntSlider("  Clouds Num: ", CloudSystem.NumberClouds, 1, CloudSystem.MaximunClouds);
			EditorGUILayout.Separator();
			CloudSystem.Side = EditorGUILayout.Vector3Field("  Cloud Creation Size: ", CloudSystem.Side);
			CloudSystem.DisappearMultiplier = EditorGUILayout.Slider("  Dissapear Mult: ", CloudSystem.DisappearMultiplier, 1, 10);
			EditorGUILayout.Separator();
			CloudSystem.MaximunVelocity = EditorGUILayout.Vector3Field("  Maximun Velocity: ", CloudSystem.MaximunVelocity);
			CloudSystem.VelocityMultipier = EditorGUILayout.Slider("  Velocity Mult: ", CloudSystem.VelocityMultipier, 0, 20);
			EditorGUILayout.Separator();
			CloudSystem.PaintType = (CloudsToy.TypePaintDistr)EditorGUILayout.EnumPopup("  Paint Type: ", CloudSystem.PaintType);
			if(CloudSystem.CloudRender == CloudsToy.TypeRender.Realistic)
				CloudSystem.CloudColor = EditorGUILayout.ColorField("  Cloud Color: ", CloudSystem.CloudColor);
			CloudSystem.MainColor = EditorGUILayout.ColorField("  Main Color: ", CloudSystem.MainColor);
			CloudSystem.SecondColor = EditorGUILayout.ColorField("  Secondary Color: ", CloudSystem.SecondColor);
			CloudSystem.TintStrength = EditorGUILayout.IntSlider("  Tint Strength: ", CloudSystem.TintStrength, 1, 100);
			if(CloudSystem.PaintType == CloudsToy.TypePaintDistr.Below)
				CloudSystem.offset = EditorGUILayout.Slider("  Offset: ", CloudSystem.offset, 0, 1);
			EditorGUILayout.Separator();
			CloudSystem.MaxWithCloud = EditorGUILayout.IntSlider("  Width: ", CloudSystem.MaxWithCloud, 10, 1000);
			CloudSystem.MaxTallCloud = EditorGUILayout.IntSlider("  Height: ", CloudSystem.MaxTallCloud, 5, 500);
			CloudSystem.MaxDepthCloud = EditorGUILayout.IntSlider("  Depth: ", CloudSystem.MaxDepthCloud, 5, 1000);
			CloudSystem.FixedSize = EditorGUILayout.Toggle("  Fixed Size", CloudSystem.FixedSize);
			EditorGUILayout.Separator();
			CloudSystem.IsAnimate = EditorGUILayout.Toggle("  Animate Cloud", CloudSystem.IsAnimate);
			if(CloudSystem.IsAnimate) 
				CloudSystem.AnimationVelocity = EditorGUILayout.Slider("  Animation Velocity: ", CloudSystem.AnimationVelocity, 0, 1);
			CloudSystem.NumberOfShadows = (CloudsToy.TypeShadow)EditorGUILayout.EnumPopup("  Shadows: ", CloudSystem.NumberOfShadows);
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			
			EditorGUILayout.LabelField("Texture Add", "Used for Bright Clouds");
			EditorGUILayout.BeginHorizontal();
			for(i = 0; i < CloudSystem.CloudsTextAdd.Length; i++){
				if(i == CloudSystem.CloudsTextAdd.Length/2){
					EditorGUILayout.EndHorizontal();
					EditorGUILayout.Separator();
					EditorGUILayout.BeginHorizontal();
				}
				else
				if(i != 0 && i != 3)
					EditorGUILayout.Separator();
				CloudSystem.CloudsTextAdd[i] = (Texture2D)EditorGUILayout.ObjectField(CloudSystem.CloudsTextAdd[i], typeof(Texture2D), GUILayout.Width(70), GUILayout.Height(70));
			}
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			
			EditorGUILayout.LabelField("Text Blended", "Used for Realistic Clouds");
			EditorGUILayout.BeginHorizontal();
			for(i = 0; i < CloudSystem.CloudsTextBlended.Length; i++){
				if(i == CloudSystem.CloudsTextBlended.Length/2){
					EditorGUILayout.EndHorizontal();
					EditorGUILayout.Separator();
					EditorGUILayout.BeginHorizontal();
				}
				else
				if(i != 0 && i != 3)
					EditorGUILayout.Separator();
				CloudSystem.CloudsTextBlended[i] = (Texture2D)EditorGUILayout.ObjectField(CloudSystem.CloudsTextBlended[i], typeof(Texture2D), GUILayout.Width(70), GUILayout.Height(70));
			}
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Separator();
			if (GUI.changed)
				EditorUtility.SetDirty (CloudSystem);
			GUI.changed = false;
			break;
			
			
		case 1:
			if(!ProcText){
				CloudSystem.PT1TextureWidth = EditorGUILayout.IntField("  Texture Width: ", CloudSystem.PT1TextureWidth);
				CloudSystem.PT1TextureHeight = EditorGUILayout.IntField("  Texture Height: ", CloudSystem.PT1TextureHeight);
				if (GUI.changed && ProcText) {
					EditorUtility.SetDirty(CloudSystem);
				}
			}
			GUI.changed = false;
			EditorGUILayout.Separator();
			CloudSystem.PT1TypeNoise = (CloudsToy.NoisePresetPT1)EditorGUILayout.EnumPopup("  Type Noise: ", CloudSystem.PT1TypeNoise);
			EditorGUILayout.Separator();
			CloudSystem.PT1Seed = EditorGUILayout.IntSlider("  Seed: ", CloudSystem.PT1Seed, 1, 10000);
			EditorGUILayout.Separator();
			if (GUI.changed && ProcText) {
				CloudSystem.PT1NewRandomSeed();
				EditorUtility.SetDirty(CloudSystem);
			}
			GUI.changed = false;
			CloudSystem.PT1ScaleWidth = EditorGUILayout.Slider("  Scale Width: ", CloudSystem.PT1ScaleWidth, 0.1f, 50.0f);
			CloudSystem.PT1ScaleHeight = EditorGUILayout.Slider("  Scale Height: ", CloudSystem.PT1ScaleHeight, 0.1f, 50.0f);
			CloudSystem.PT1ScaleFactor = EditorGUILayout.Slider("  Scale Factor: ", CloudSystem.PT1ScaleFactor, 0.1f, 2.0f);
			EditorGUILayout.Separator();
			if(CloudSystem.PT1TypeNoise == CloudsToy.NoisePresetPT1.PerlinCloud){
				CloudSystem.PT1Lacunarity = EditorGUILayout.Slider("  Lacunarity: ", CloudSystem.PT1Lacunarity, 0.0f, 10.0f);
				CloudSystem.PT1FractalIncrement = EditorGUILayout.Slider("  FractalIncrement: ", CloudSystem.PT1FractalIncrement, 0.0f, 2.0f);
				CloudSystem.PT1Octaves = EditorGUILayout.Slider("  Octaves: ", CloudSystem.PT1Octaves, 0.0f, 10.0f);
				CloudSystem.PT1Offset = EditorGUILayout.Slider("  Offset: ", CloudSystem.PT1Offset, 0.1f, 3.0f);
			}else
			if(CloudSystem.PT1TypeNoise == CloudsToy.NoisePresetPT1.Cloud){
				CloudSystem.PT1TurbSize = EditorGUILayout.IntSlider("  Turb Size: ", CloudSystem.PT1TurbSize, 1, 256);
				CloudSystem.PT1TurbLacun = EditorGUILayout.Slider("  Turb Lacun: ", CloudSystem.PT1TurbLacun, 0.01f, 0.99f);
				CloudSystem.PT1TurbGain = EditorGUILayout.Slider("  Turb Gain: ", CloudSystem.PT1TurbGain, 0.01f, 2.99f);
				CloudSystem.PT1xyPeriod = EditorGUILayout.Slider("  Radius: ", CloudSystem.PT1xyPeriod, 0.1f, 2.0f);
				CloudSystem.PT1turbPower = EditorGUILayout.Slider("  Turb Power: ", CloudSystem.PT1turbPower, 1, 60);
			}
			EditorGUILayout.Separator();
			/*CloudSystem.PT1IsHalo = EditorGUILayout.Toggle("  Halo Active:", CloudSystem.PT1IsHalo);
			if(CloudSystem.PT1IsHalo)*/
			CloudSystem.PT1HaloEffect = EditorGUILayout.Slider("  HaloEffect: ", CloudSystem.PT1HaloEffect, 0.1f, 1.7f);
			CloudSystem.PT1HaloInsideRadius = EditorGUILayout.Slider("  Inside Radius: ", CloudSystem.PT1HaloInsideRadius, 0.1f, 3.5f);
			EditorGUILayout.Separator();
			/*CloudSystem.PT1BackgroundColor = EditorGUILayout.ColorField("  Back Color: ", CloudSystem.PT1BackgroundColor);
			CloudSystem.PT1FinalColor = EditorGUILayout.ColorField("  Front Color: ", CloudSystem.PT1FinalColor);*/
			CloudSystem.PT1InvertColors = EditorGUILayout.Toggle("  Invert Colors:", CloudSystem.PT1InvertColors);
			CloudSystem.PT1ContrastMult = EditorGUILayout.Slider("  Contrast Mult: ", CloudSystem.PT1ContrastMult, 0.0f, 2.0f);
			EditorGUILayout.Separator();
			CloudSystem.PT1UseAlphaTexture = EditorGUILayout.Toggle("  Alpha Texture:", CloudSystem.PT1UseAlphaTexture);
			if(CloudSystem.PT1UseAlphaTexture)
				CloudSystem.PT1AlphaIndex = EditorGUILayout.Slider("  Alpha Index: ", CloudSystem.PT1AlphaIndex, 0.0f, 1.0f);
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			
			// Be sure that the Texture1 class exists before try to paint the textures.
			if(ProcText){
				MyWidth = EditorGUILayout.IntSlider("  BoxDraw Text: ", MyWidth, 50, 200);
				EditorGUILayout.Separator();
				EditorGUILayout.BeginHorizontal();
				EditorGUILayout.Space();
				ProcText.MyTexture = (Texture2D)EditorGUILayout.ObjectField(ProcText.MyTexture, typeof(Texture2D), GUILayout.Width(MyWidth), GUILayout.Height(MyWidth));
				EditorGUILayout.Separator();
				EditorGUILayout.Space();
				if(CloudSystem.PT1UseAlphaTexture)
					ProcText.MyAlphaDrawTexture = (Texture2D)EditorGUILayout.ObjectField(ProcText.MyAlphaDrawTexture, typeof(Texture2D), GUILayout.Width(MyWidth), GUILayout.Height(MyWidth));
				EditorGUILayout.Separator();
				EditorGUILayout.EndHorizontal();
				EditorGUILayout.Separator();
				EditorGUILayout.Separator();
				EditorGUILayout.Separator();
			}
			
			Rect buttonRectPT1 = EditorGUILayout.BeginHorizontal();
			buttonRectPT1.x = buttonRectPT1.width / 2 - 100;
			buttonRectPT1.width = 200;
			buttonRectPT1.height = 30;
			//GUI.skin??
			if(GUI.Button(buttonRectPT1, "Reset Parameters")){
				CloudSystem.ResetCloudParameters();
				if(ProcText){
					CloudSystem.PT1CopyParameters();
				}
			}
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			// Is the program being executed? If so, show the 'Save Params' button.
			if(ProcText){
				Rect buttonRectPrint = EditorGUILayout.BeginHorizontal();
				buttonRectPrint.x = buttonRectPrint.width / 2 - 100;
				buttonRectPrint.width = 200;
				buttonRectPrint.height = 30;
				//GUI.skin??
				if(GUI.Button(buttonRectPrint, "Save Texture")){
					CloudSystem.SaveProceduralTexture();
				}
			}
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();

			if (GUI.changed){
				if(ProcText){
					CloudSystem.PT1CopyParameters();
					CloudSystem.ModifyPTMaterials();
				}
				EditorUtility.SetDirty (CloudSystem);
			}
			GUI.changed = false;
			
			break;
		
		}
		EditorGUILayout.EndVertical();
    }
    public override void OnInspectorGUI(){
		//EditorGUIUtility.LookLikeInspector();
		EditorGUIUtility.LookLikeControls();
		CloudSystem = (CloudsToy) target;

		if (!CloudSystem.gameObject) return; // If there isn't any cloudstoy gameobject in your scene, just return and do nothing at all.

		ProcText = (ProceduralCloudTexture) CloudSystem.ProceduralTexture;

		myColor = GUI.color;

		GUIStyle redFoldoutStyle = new GUIStyle(EditorStyles.foldout);
		redFoldoutStyle.normal.textColor = Color.red;
		redFoldoutStyle.focused.textColor = Color.red;
		redFoldoutStyle.hover.textColor = Color.red;
		redFoldoutStyle.active.textColor = Color.red;

		EditorGUILayout.BeginVertical();
		EditorGUILayout.Separator();
		EditorGUILayout.Separator();
		string[] MenuOptions = new string[2];
		MenuOptions[0] = "    Clouds    ";
		MenuOptions[1] = "Proc Texture";
		CloudSystem.ToolbarOptions = GUILayout.Toolbar(CloudSystem.ToolbarOptions, MenuOptions);
		EditorGUILayout.Separator();
		EditorGUILayout.Separator();
		EditorGUILayout.Separator();
		EditorGUILayout.EndVertical();
		EditorGUILayout.BeginVertical();
		switch (CloudSystem.ToolbarOptions){
			
			
		case 0: 
			// Is the CloudsToy being executed in Unity? If not, show the Maximun Clouds parameter.
			GUIContent contentFoldout = new GUIContent(" Maximun Clouds (DO NOT change while executing)", "Set the maximun clouds number that" +
			                                           "the CloudsToy system will handle. Changing this variable in runtime will crash the application.");
			if(!ProcText)
			{
				GUI.color = Color.red; 
				showMaximunClouds = EditorGUILayout.Foldout(showMaximunClouds, contentFoldout, redFoldoutStyle);

				if(showMaximunClouds)
					CloudSystem.MaximunClouds = EditorGUILayout.IntField("  ", CloudSystem.MaximunClouds);

				if (GUI.changed)
					EditorUtility.SetDirty(CloudSystem);
				GUI.color = myColor; 
				GUI.changed = false;
				EditorGUILayout.Separator();
				EditorGUILayout.Separator();
			}
			GUIContent contentCloud = new GUIContent("  Cloud Presets: ", "Cloud pressets to quickly start configuring the clouds style");
			CloudSystem.CloudPreset = (CloudsToy.TypePreset)EditorGUILayout.EnumPopup(contentCloud, CloudSystem.CloudPreset);
			if (GUI.changed)
			{
				if(CloudSystem.CloudPreset == CloudsToy.TypePreset.Stormy)
					CloudSystem.SetPresetStormy();
				else
				if(CloudSystem.CloudPreset == CloudsToy.TypePreset.Sunrise)
					CloudSystem.SetPresetSunrise();
				else
				if(CloudSystem.CloudPreset == CloudsToy.TypePreset.Fantasy)
					CloudSystem.SetPresetFantasy();
				EditorUtility.SetDirty(CloudSystem);
			}
			GUI.changed = false;
			
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Cloud Render: ", "Assign the shader that will be used to render the clouds particles.");
			CloudSystem.CloudRender = (CloudsToy.TypeRender)EditorGUILayout.EnumPopup(contentCloud, CloudSystem.CloudRender);
			contentCloud = new GUIContent("  Cloud Type: ", "Assign the texture that will be used to draw the clouds.");
			CloudSystem.TypeClouds = (CloudsToy.Type)EditorGUILayout.EnumPopup(contentCloud, CloudSystem.TypeClouds);
			contentCloud = new GUIContent("  Cloud Detail: ", "Cloud complexity that will created more populated clouds. " +
										  "Be aware that higher levels can drop your FPS drasticaly if there are a lot of clouds.");
			CloudSystem.CloudDetail = (CloudsToy.TypeDetail)EditorGUILayout.EnumPopup(contentCloud, CloudSystem.CloudDetail);
			if (GUI.changed)
			{
				CloudSystem.SetCloudDetailParams();
				EditorUtility.SetDirty(CloudSystem);
			}
			GUI.changed = false;
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();

			GUI.color = Color.red; 
			contentFoldout = new GUIContent(" Particles Shader Settings", "You can change the shaders used in the clouds." +
				"It can be used, for example, to use different shaders in mobile applications.");
			showShaderSettings = EditorGUILayout.Foldout(showShaderSettings, contentFoldout, redFoldoutStyle);
			if(showShaderSettings)
			{
				EditorGUILayout.Separator();
				contentCloud = new GUIContent("Realistic Cloud Shader:", "Shader that will be used when selecting Realistic Clouds. This shader will use" +
					"the blended textures that can be assigned in the CloudsToy Texture paragraph. It is an alpha blended shader.");
				CloudSystem.realisticShader = (Shader)EditorGUILayout.ObjectField(contentCloud, CloudSystem.realisticShader, typeof(Shader), false);
				contentCloud = new GUIContent("Bright Cloud Shader:", "Shader that will be used when selecting Bright Clouds. This shader will use" +
				                              "the add textures that can be assigned in the CloudsToy Texture paragraph. It is an alpha additive shader.");
				CloudSystem.brightShader = (Shader)EditorGUILayout.ObjectField(contentCloud, CloudSystem.brightShader, typeof(Shader), false);
				contentCloud = new GUIContent("Projector Material:", "The projector material will be used to create the clouds shadows. " +
											  "By default it is usedthe Unity's default projector material.");
				CloudSystem.projectorMaterial = (Material)EditorGUILayout.ObjectField(contentCloud, CloudSystem.projectorMaterial, typeof(Material), false);
				EditorGUILayout.Separator();
			}
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();

			contentFoldout = new GUIContent(" Particles Advanced Settings", "This section provides of two parameters to tweak your clouds. " +
				"It will be applied to all the cloud system. Those values can make your FPS drop drastically is you select very high values. Take it into account!");
			showAdvancedSettings = EditorGUILayout.Foldout(showAdvancedSettings, contentFoldout, redFoldoutStyle);
			if(showAdvancedSettings)
			{
				EditorGUILayout.Separator();
				contentCloud = new GUIContent("  Size Factor: ", "Modify the initial ellipsoid from wich the cloud particle is generated, so smaller (or bigger) clouds will be created.");
				CloudSystem.SizeFactorPart = EditorGUILayout.Slider(contentCloud, CloudSystem.SizeFactorPart, 0.1f, 4.0f);
				contentCloud = new GUIContent("  Emitter Mult: ", "Modify the minimun/maximun emission particle cloud, so more (or less) populated clouds will be created.");
				CloudSystem.EmissionMult = EditorGUILayout.Slider(contentCloud, CloudSystem.EmissionMult, 0.1f, 4.0f);
				EditorGUILayout.Separator();
			}
			GUI.color = myColor; 
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			Rect buttonRect = EditorGUILayout.BeginHorizontal();
			buttonRect.x = buttonRect.width / 2 - 100;
			buttonRect.width = 200;
			buttonRect.height = 30;

			GUI.color = Color.red; 
			contentCloud = new GUIContent("Repaint Clouds", "Unity scene cloud regeneration and repainting. Use it when you want to be sure that all your tweaked adjustments are being applied to your clouds in the scene." +
			                              "It's ment to be used only in Unity while adjusting your clouds. DO NOT USE IT in your game in realtime execution; you will be recreating your clouds in your game just for nothing.");
			if(GUI.Button(buttonRect, contentCloud))
				CloudSystem.EditorRepaintClouds();
			GUI.color = myColor;

			EditorGUILayout.Separator();
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Soft Clouds", "Modify particle render to stretch mode instead of the regular billboard mode.");
			CloudSystem.SoftClouds = EditorGUILayout.Toggle(contentCloud, CloudSystem.SoftClouds);
			if(CloudSystem.SoftClouds)
			{
				contentCloud = new GUIContent("  Spread Direction: ", "The world particle velocity that will be applied to the stretched clouds particles.");
				#if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6
				CloudSystem.SpreadDir = EditorGUILayout.Vector3Field("  Spread Direction: ", CloudSystem.SpreadDir);
				#else
				CloudSystem.SpreadDir = EditorGUILayout.Vector3Field(contentCloud, CloudSystem.SpreadDir);
				#endif
				contentCloud = new GUIContent("  Length Spread: ", "The scale lenght to which the clouds will be stretched to.");
				CloudSystem.LengthSpread = EditorGUILayout.Slider(contentCloud, CloudSystem.LengthSpread, 1, 30);
			}
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Clouds Num: ", "Number of clouds that will be created. The maximum number of clouds that CloudsToy will handle" +
				"can be configured in the Maximum clouds parameter, the first cloudsToy parameter");
			CloudSystem.NumberClouds = EditorGUILayout.IntSlider(contentCloud, CloudSystem.NumberClouds, 1, CloudSystem.MaximunClouds);
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Cloud Creation Size: ", "The scene blue box size where the clouds will be created into initially.");
			#if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6
			CloudSystem.Side = EditorGUILayout.Vector3Field("  Cloud Creation Size: ", CloudSystem.Side);
			#else
			CloudSystem.Side = EditorGUILayout.Vector3Field(contentCloud, CloudSystem.Side);
			#endif
			contentCloud = new GUIContent("  Dissapear Mult: ", "The scene yellow box will be calculated as a multiplier of the blue box. It is used" +
				"to know when to remove a cloud. So, when clouds are moving in any direction, as soon as they reach the yellow box border, they will be moved to the other side of the box");
			CloudSystem.DisappearMultiplier = EditorGUILayout.Slider(contentCloud, CloudSystem.DisappearMultiplier, 1, 10);
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Maximum Velocity: ", "The clouds maximum velocity. Bigger clouds will be slower than the smaller ones.");
			#if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6
			CloudSystem.MaximunVelocity = EditorGUILayout.Vector3Field("  Maximun Velocity: ", CloudSystem.MaximunVelocity);
			#else
			CloudSystem.MaximunVelocity = EditorGUILayout.Vector3Field(contentCloud, CloudSystem.MaximunVelocity);
			#endif
			contentCloud = new GUIContent("  Velocity Mult: ", "A velocity multiplier to quickly tweak the clouds velocity without modifying the previous parameter.");
			CloudSystem.VelocityMultipier = EditorGUILayout.Slider(contentCloud, CloudSystem.VelocityMultipier, 0, 20);
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Paint Type: ", "The clouds can be colorized with different adjustable colors using two diferent presets. Below paint type will be try to change the color of the" +
				"lower cloud particles to simulate how real clouds look like.");
			CloudSystem.PaintType = (CloudsToy.TypePaintDistr)EditorGUILayout.EnumPopup(contentCloud, CloudSystem.PaintType);
			/*if(CloudSystem.CloudRender == CloudsToy.TypeRender.Realistic)
			{*/
				contentCloud = new GUIContent("  Cloud Color: ", "Main cloud color used only in Realistic render mode. This color" +
					"will be directly assigned to the cloud realistic shader Tint color used by realistic particle clouds.");
				CloudSystem.CloudColor = EditorGUILayout.ColorField(contentCloud, CloudSystem.CloudColor);
			/*}*/
			contentCloud = new GUIContent("  Main Color: ", "This is the main color used when trying colorize the cloud.");
			CloudSystem.MainColor = EditorGUILayout.ColorField(contentCloud, CloudSystem.MainColor);
			contentCloud = new GUIContent("  Secondary Color: ", "This is the second color used when trying colorize the cloud.");
			CloudSystem.SecondColor = EditorGUILayout.ColorField(contentCloud, CloudSystem.SecondColor);
			contentCloud = new GUIContent("  Tint Strength: ", "Higher strenth will tint more cloud particles in the cloud.");
			CloudSystem.TintStrength = EditorGUILayout.IntSlider(contentCloud, CloudSystem.TintStrength, 1, 100);
			if(CloudSystem.PaintType == CloudsToy.TypePaintDistr.Below)
			{
				contentCloud = new GUIContent("  Offset: ", "Will be used in the below paint type to tint the cloud particles depending on" +
					"their relative position inside the cloud. Higher values will paint particles that are in high local positions inside the cloud");
				CloudSystem.offset = EditorGUILayout.Slider(contentCloud, CloudSystem.offset, 0, 1);
			}
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Width: ", "Maximum width of each cloud");
			CloudSystem.MaxWithCloud = EditorGUILayout.IntSlider(contentCloud, CloudSystem.MaxWithCloud, 10, 1000);
			contentCloud = new GUIContent("  Height: ", "Maximum height of each cloud");
			CloudSystem.MaxTallCloud = EditorGUILayout.IntSlider(contentCloud, CloudSystem.MaxTallCloud, 5, 500);
			contentCloud = new GUIContent("  Depth: ", "Maximum depth of each cloud");
			CloudSystem.MaxDepthCloud = EditorGUILayout.IntSlider(contentCloud, CloudSystem.MaxDepthCloud, 5, 1000);
			contentCloud = new GUIContent("  Fixed Size", "The size of the clouds will be exactly the same depending on their cloud" +
				"size type (big, medium, small). If fixed size is disabled all the big clouds (for example) will not have the exact same size");
			CloudSystem.FixedSize = EditorGUILayout.Toggle(contentCloud, CloudSystem.FixedSize);
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Animate Cloud", "Each cloud can be animated making it to rotate over itself.");
			CloudSystem.IsAnimate = EditorGUILayout.Toggle(contentCloud, CloudSystem.IsAnimate);
			if(CloudSystem.IsAnimate)
			{
				contentCloud = new GUIContent("  Animation Velocity: ", "Cloud rotation velocity.");
				CloudSystem.AnimationVelocity = EditorGUILayout.Slider(contentCloud, CloudSystem.AnimationVelocity, 0, 1);
			}
			contentCloud = new GUIContent("  Shadows: ", "Clouds can have a shadow. It is made using a Unity's projector that creates a shadow" +
				"taking into account the layer the clouds are in (so they will ignore the cloud particle itself when drawing their own shadow");
			CloudSystem.NumberOfShadows = (CloudsToy.TypeShadow)EditorGUILayout.EnumPopup(contentCloud, CloudSystem.NumberOfShadows);
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();

			contentCloud = new GUIContent("Texture Add", "These are the textures that will be used by bright type clouds. Bright clouds " +
				"use a particle additive kind of shader.");
			GUIContent contentCloud2 = new GUIContent("(Used for Bright Clouds)", "");
			EditorGUILayout.LabelField(contentCloud, contentCloud2);
			EditorGUILayout.BeginHorizontal();
			for(i = 0; i < CloudSystem.CloudsTextAdd.Length; i++)
			{
				if(i == CloudSystem.CloudsTextAdd.Length/2)
				{
					EditorGUILayout.EndHorizontal();
					EditorGUILayout.Separator();
					EditorGUILayout.BeginHorizontal();
				}
				else
				if(i != 0 && i != 3)
					EditorGUILayout.Separator();
				CloudSystem.CloudsTextAdd[i] = (Texture2D)EditorGUILayout.ObjectField(CloudSystem.CloudsTextAdd[i], typeof(Texture2D), false, GUILayout.Width(70), GUILayout.Height(70));
			}
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();

			contentCloud = new GUIContent("Texture Blended", "These are the textures that will be used by realistic type clouds. Bright clouds " +
			                              "use a particle blended additive kind of shader.");
			contentCloud2 = new GUIContent("(Used for Realistic Clouds)", "");
			EditorGUILayout.LabelField(contentCloud, contentCloud2);
			EditorGUILayout.BeginHorizontal();
			for(i = 0; i < CloudSystem.CloudsTextBlended.Length; i++)
			{
				if(i == CloudSystem.CloudsTextBlended.Length/2)
				{
					EditorGUILayout.EndHorizontal();
					EditorGUILayout.Separator();
					EditorGUILayout.BeginHorizontal();
				}
				else
				if(i != 0 && i != 3)
					EditorGUILayout.Separator();
				CloudSystem.CloudsTextBlended[i] = (Texture2D)EditorGUILayout.ObjectField(CloudSystem.CloudsTextBlended[i], typeof(Texture2D), false, GUILayout.Width(70), GUILayout.Height(70));
			}
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Separator();
			if (GUI.changed)
				EditorUtility.SetDirty (CloudSystem);
			GUI.changed = false;
			break;
			
			
		case 1:
			if(!ProcText)
			{
				GUI.color = Color.red; 
				contentCloud = new GUIContent("  Texture Width: ", "Texture width used to create the runtime noise based texture. Because the texture is generated at runtime, " +
					"big texture sizes will slow the process. The texture is generated pixel by pixel so an 256x256 texture will be FOUR TIMES SLOWER than a 128x128 texture");
				CloudSystem.PT1TextureWidth = EditorGUILayout.IntField(contentCloud, CloudSystem.PT1TextureWidth);
				contentCloud = new GUIContent("  Texture Height: ", "Texture height used to create the runtime noise based texture. Because the texture is generated at runtime, " +
				                              "big texture sizes will slow the process. The texture is generated pixel by pixel so an 256x256 texture will be FOUR TIMES SLOWER than a 128x128 texture");
				CloudSystem.PT1TextureHeight = EditorGUILayout.IntField(contentCloud, CloudSystem.PT1TextureHeight);
				if (GUI.changed && ProcText)
					EditorUtility.SetDirty(CloudSystem);
				GUI.color = myColor; 
			}
			GUI.changed = false;
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Type of Noise: ", "There are two different noise generator algorithms: The standard noise generation (Cloud) and the usual perlin noise generator.");
			CloudSystem.PT1TypeNoise = (CloudsToy.NoisePresetPT1)EditorGUILayout.EnumPopup(contentCloud, CloudSystem.PT1TypeNoise);
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Seed: ", "This value is the basic seed value to generate any ramdom noise Diferent values will generate different noise patterns.");
			CloudSystem.PT1Seed = EditorGUILayout.IntSlider(contentCloud, CloudSystem.PT1Seed, 1, 10000);
			EditorGUILayout.Separator();
			if (GUI.changed && ProcText)
			{
				CloudSystem.PT1NewRandomSeed();
				EditorUtility.SetDirty(CloudSystem);
			}
			GUI.changed = false;

			contentCloud = new GUIContent("  Scale Width: ", "Internal noise scale width used when generating the noise pattern.");
			CloudSystem.PT1ScaleWidth = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1ScaleWidth, 0.1f, 50.0f);
			contentCloud = new GUIContent("  Scale Height: ", "Internal noise scale height used when generating the noise pattern.");
			CloudSystem.PT1ScaleHeight = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1ScaleHeight, 0.1f, 50.0f);
			contentCloud = new GUIContent("  Scale Factor: ", "Scale multiplier used to quickly tweak the scale width/height at once.");
			CloudSystem.PT1ScaleFactor = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1ScaleFactor, 0.1f, 2.0f);
			EditorGUILayout.Separator();
			if(CloudSystem.PT1TypeNoise == CloudsToy.NoisePresetPT1.PerlinCloud)
			{
				contentCloud = new GUIContent("  Lacunarity: ", "Lacunarity parameter used by Perlin noise generator.");
				CloudSystem.PT1Lacunarity = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1Lacunarity, 0.0f, 10.0f);
				contentCloud = new GUIContent("  FractalIncrement: ", "FractalIncrement parameter used by Perlin noise generator.");
				CloudSystem.PT1FractalIncrement = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1FractalIncrement, 0.0f, 2.0f);
				contentCloud = new GUIContent("  Octaves: ", "Octave parameter used by Perlin noise generator.");
				CloudSystem.PT1Octaves = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1Octaves, 0.0f, 10.0f);
				contentCloud = new GUIContent("  Offset: ", "Offset parameter used by Perlin noise generator (HybridMultifractal noise functions).");
				CloudSystem.PT1Offset = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1Offset, 0.1f, 3.0f);
			}else
			if(CloudSystem.PT1TypeNoise == CloudsToy.NoisePresetPT1.Cloud)
			{
				contentCloud = new GUIContent("  Turb Size: ", "Turbulence parameter used by SimpleNoise Turbulence generator. Internally, this is the octaves parameter" +
					"used to calculate the turbulence of an already created SimpleNoise texture.");
				CloudSystem.PT1TurbSize = EditorGUILayout.IntSlider(contentCloud, CloudSystem.PT1TurbSize, 1, 256);
				contentCloud = new GUIContent("  Turb Lacun: ", "Lacunarity parameter used by SimpleNoise Turbulence generator. Internally, this is the lacunarity parameter" +
				                              "used to calculate the turbulence of an already created SimpleNoise texture.");
				CloudSystem.PT1TurbLacun = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1TurbLacun, 0.01f, 0.99f);
				contentCloud = new GUIContent("  Turb Gain: ", "Gain parameter used by SimpleNoise Turbulence generator. Internally, this is the gain parameter" +
				                              "used to calculate the turbulence of an already created SimpleNoise texture. Higher values will generate brighter textures.");
				CloudSystem.PT1TurbGain = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1TurbGain, 0.01f, 2.99f);
				contentCloud = new GUIContent("  Radius: ", "Used to adjust the noise turbulence. Lower values will generate darker textures because the resulting texture" +
					"will dark the pixels outside that radious.");
				CloudSystem.PT1xyPeriod = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1xyPeriod, 0.1f, 2.0f);
				contentCloud = new GUIContent("  Turb Power: ", "Turbulence multipler that will affect the pixels inside the turbulence radious. " +
					"Higher values will generate brighter results BUT it will only affect the pixels inside a given Radious.");
				CloudSystem.PT1turbPower = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1turbPower, 1, 60);
			}
			EditorGUILayout.Separator();
			/*CloudSystem.PT1IsHalo = EditorGUILayout.Toggle("  Halo Active:", CloudSystem.PT1IsHalo);
			if(CloudSystem.PT1IsHalo)*/
			contentCloud = new GUIContent("  HaloEffect: ", "Will create a dark halo around the texture, used to make rounded textures that can be used to draw the clouds.");
			CloudSystem.PT1HaloEffect = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1HaloEffect, 0.1f, 1.7f);
			contentCloud = new GUIContent("  Inside Radius: ", "Will dark the pixels inside the Halo, used to teawk rounded textures that can be used to draw the clouds.");
			CloudSystem.PT1HaloInsideRadius = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1HaloInsideRadius, 0.1f, 3.5f);
			EditorGUILayout.Separator();
			/*CloudSystem.PT1BackgroundColor = EditorGUILayout.ColorField("  Back Color: ", CloudSystem.PT1BackgroundColor);
			CloudSystem.PT1FinalColor = EditorGUILayout.ColorField("  Front Color: ", CloudSystem.PT1FinalColor);*/
			contentCloud = new GUIContent("  Invert Colors:", "Invert the texture colors.");
			CloudSystem.PT1InvertColors = EditorGUILayout.Toggle(contentCloud, CloudSystem.PT1InvertColors);
			contentCloud = new GUIContent("  Contrast Mult: ", "Higher values will create brighter textures.");
			CloudSystem.PT1ContrastMult = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1ContrastMult, 0.0f, 2.0f);
			EditorGUILayout.Separator();
			contentCloud = new GUIContent("  Alpha Texture:", "It will create a second texture with transparency so the alpha channel can be tweaked." +
				"This new alpha texture will be draw in the inspector so you can see the alpha channel (the alpha values will be shown in green color.");
			CloudSystem.PT1UseAlphaTexture = EditorGUILayout.Toggle(contentCloud, CloudSystem.PT1UseAlphaTexture);
			if(CloudSystem.PT1UseAlphaTexture)
			{
				contentCloud = new GUIContent("  Alpha Index: ", "This value 0-1 will be used to increase/decrease the texture's alpha channel.");
				CloudSystem.PT1AlphaIndex = EditorGUILayout.Slider(contentCloud, CloudSystem.PT1AlphaIndex, 0.0f, 1.0f);
			}
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			
			// Be sure that the Texture1 class exists before try to paint the textures.
			if(ProcText)
			{
				contentCloud = new GUIContent("  InEditor Text Size ", "Texture size used only in the inspector window.");
				MyWidth = EditorGUILayout.IntSlider(contentCloud, MyWidth, 50, 200);
				EditorGUILayout.Separator();
				EditorGUILayout.BeginHorizontal();
				EditorGUILayout.Space();
				ProcText.MyTexture = (Texture2D)EditorGUILayout.ObjectField(ProcText.MyTexture, typeof(Texture2D), false, GUILayout.Width(MyWidth), GUILayout.Height(MyWidth));
				EditorGUILayout.Separator();
				EditorGUILayout.Space();
				if(CloudSystem.PT1UseAlphaTexture)
					ProcText.MyAlphaDrawTexture = (Texture2D)EditorGUILayout.ObjectField(ProcText.MyAlphaDrawTexture, typeof(Texture2D), false, GUILayout.Width(MyWidth), GUILayout.Height(MyWidth));
				EditorGUILayout.Separator();
				EditorGUILayout.EndHorizontal();
				EditorGUILayout.Separator();
				EditorGUILayout.Separator();
				EditorGUILayout.Separator();
			}
			
			Rect buttonRectPT1 = EditorGUILayout.BeginHorizontal();
			buttonRectPT1.x = buttonRectPT1.width / 2 - 100;
			buttonRectPT1.width = 200;
			buttonRectPT1.height = 30;
			//GUI.skin??
			GUI.color = Color.red; 
			contentCloud = new GUIContent("Reset Parameters", "Reset the noise parameters to their default values.");
			if(GUI.Button(buttonRectPT1, contentCloud))
			{
				CloudSystem.ResetCloudParameters();
				if(ProcText)
					CloudSystem.PT1CopyParameters();
			}
			EditorGUILayout.EndHorizontal();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			// Is the program being executed? If so, show the 'Save Params' button.
			GUI.color = Color.yellow;
			if(ProcText)
			{
				Rect buttonRectPrint = EditorGUILayout.BeginHorizontal();
				buttonRectPrint.x = buttonRectPrint.width / 2 - 100;
				buttonRectPrint.width = 200;
				buttonRectPrint.height = 30;
				//GUI.skin??
				contentCloud = new GUIContent("Save Texture", "Save the generated texture to a file. CAUTION: This funcion can not be used in Web Player targeted projects.");
				if(GUI.Button(buttonRectPrint, contentCloud))
					CloudSystem.SaveProceduralTexture();
				EditorGUILayout.EndHorizontal();
			}

			GUI.color = myColor; 
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();
			EditorGUILayout.Separator();

			if (GUI.changed)
			{
				if(ProcText)
				{
					CloudSystem.PT1CopyParameters();
					CloudSystem.ModifyPTMaterials();
				}
				EditorUtility.SetDirty (CloudSystem);
			}
			GUI.changed = false;
			
			break;
		
		}
		EditorGUILayout.EndVertical();
    }
Example #8
0
    public override void OnInspectorGUI()
    {
        //EditorGUIUtility.LookLikeInspector();
        EditorGUIUtility.LookLikeControls();
        CloudSystem = (CloudsToy)target;
        if (!CloudSystem.gameObject)
        {
            return;
        }

        ProcText = (ProceduralCloudTexture)CloudSystem.ProceduralTexture;

        EditorGUILayout.BeginVertical();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        string[] MenuOptions = new string[2];
        MenuOptions[0]             = "    Clouds    ";
        MenuOptions[1]             = "Proc Texture";
        CloudSystem.ToolbarOptions = GUILayout.Toolbar(CloudSystem.ToolbarOptions, MenuOptions);
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.BeginVertical();
        switch (CloudSystem.ToolbarOptions)
        {
        case 0:
            // Is the CloudsToy being executed in Unity? If not, show the Maximun Clouds parameter.
            if (!ProcText)
            {
                showMaximunClouds = EditorGUILayout.Foldout(showMaximunClouds, " Maximun Clouds (DO NOT change while executing)");
                if (showMaximunClouds)
                {
                    CloudSystem.MaximunClouds = EditorGUILayout.IntField("  ", CloudSystem.MaximunClouds);
                }
                if (GUI.changed)
                {
                    EditorUtility.SetDirty(CloudSystem);
                }
                GUI.changed = false;
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
            }
            CloudSystem.CloudPreset = (CloudsToy.TypePreset)EditorGUILayout.EnumPopup("  Cloud Presets: ", CloudSystem.CloudPreset);
            if (GUI.changed)
            {
                if (CloudSystem.CloudPreset == CloudsToy.TypePreset.Stormy)
                {
                    CloudSystem.SetPresetStormy();
                }
                else
                if (CloudSystem.CloudPreset == CloudsToy.TypePreset.Sunrise)
                {
                    CloudSystem.SetPresetSunrise();
                }
                else
                if (CloudSystem.CloudPreset == CloudsToy.TypePreset.Fantasy)
                {
                    CloudSystem.SetPresetFantasy();
                }
                EditorUtility.SetDirty(CloudSystem);
            }
            GUI.changed = false;

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            CloudSystem.CloudRender = (CloudsToy.TypeRender)EditorGUILayout.EnumPopup("  Cloud Render: ", CloudSystem.CloudRender);
            CloudSystem.TypeClouds  = (CloudsToy.Type)EditorGUILayout.EnumPopup("  Cloud Type: ", CloudSystem.TypeClouds);
            CloudSystem.CloudDetail = (CloudsToy.TypeDetail)EditorGUILayout.EnumPopup("  Cloud Detail: ", CloudSystem.CloudDetail);
            if (GUI.changed)
            {
                CloudSystem.SetCloudDetailParams();
                EditorUtility.SetDirty(CloudSystem);
            }
            GUI.changed = false;

            showAdvancedSettings = EditorGUILayout.Foldout(showAdvancedSettings, "Particles Advanced Settings");
            if (showAdvancedSettings)
            {
                EditorGUILayout.Separator();
                CloudSystem.SizeFactorPart = EditorGUILayout.Slider("  Size Factor: ", CloudSystem.SizeFactorPart, 0.1f, 4.0f);
                CloudSystem.EmissionMult   = EditorGUILayout.Slider("  Emitter Mult: ", CloudSystem.EmissionMult, 0.1f, 4.0f);
                EditorGUILayout.Separator();
            }
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            Rect buttonRect = EditorGUILayout.BeginHorizontal();
            buttonRect.x      = buttonRect.width / 2 - 100;
            buttonRect.width  = 200;
            buttonRect.height = 30;
            //GUI.skin??
            if (GUI.Button(buttonRect, "Repaint Clouds"))
            {
                CloudSystem.EditorRepaintClouds();
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            CloudSystem.SoftClouds = EditorGUILayout.Toggle("  Soft Clouds", CloudSystem.SoftClouds);
            if (CloudSystem.SoftClouds)
            {
                CloudSystem.SpreadDir    = EditorGUILayout.Vector3Field("  Spread Direction: ", CloudSystem.SpreadDir);
                CloudSystem.LengthSpread = EditorGUILayout.Slider("  Length Spread: ", CloudSystem.LengthSpread, 1, 30);
            }
            EditorGUILayout.Separator();
            CloudSystem.NumberClouds = EditorGUILayout.IntSlider("  Clouds Num: ", CloudSystem.NumberClouds, 1, CloudSystem.MaximunClouds);
            EditorGUILayout.Separator();
            CloudSystem.Side = EditorGUILayout.Vector3Field("  Cloud Creation Size: ", CloudSystem.Side);
            CloudSystem.DisappearMultiplier = EditorGUILayout.Slider("  Dissapear Mult: ", CloudSystem.DisappearMultiplier, 1, 10);
            EditorGUILayout.Separator();
            CloudSystem.MaximunVelocity   = EditorGUILayout.Vector3Field("  Maximun Velocity: ", CloudSystem.MaximunVelocity);
            CloudSystem.VelocityMultipier = EditorGUILayout.Slider("  Velocity Mult: ", CloudSystem.VelocityMultipier, 0, 20);
            EditorGUILayout.Separator();
            CloudSystem.PaintType = (CloudsToy.TypePaintDistr)EditorGUILayout.EnumPopup("  Paint Type: ", CloudSystem.PaintType);
            if (CloudSystem.CloudRender == CloudsToy.TypeRender.Realistic)
            {
                CloudSystem.CloudColor = EditorGUILayout.ColorField("  Cloud Color: ", CloudSystem.CloudColor);
            }
            CloudSystem.MainColor    = EditorGUILayout.ColorField("  Main Color: ", CloudSystem.MainColor);
            CloudSystem.SecondColor  = EditorGUILayout.ColorField("  Secondary Color: ", CloudSystem.SecondColor);
            CloudSystem.TintStrength = EditorGUILayout.IntSlider("  Tint Strength: ", CloudSystem.TintStrength, 1, 100);
            if (CloudSystem.PaintType == CloudsToy.TypePaintDistr.Below)
            {
                CloudSystem.offset = EditorGUILayout.Slider("  Offset: ", CloudSystem.offset, 0, 1);
            }
            EditorGUILayout.Separator();
            CloudSystem.MaxWithCloud  = EditorGUILayout.IntSlider("  Width: ", CloudSystem.MaxWithCloud, 10, 1000);
            CloudSystem.MaxTallCloud  = EditorGUILayout.IntSlider("  Height: ", CloudSystem.MaxTallCloud, 5, 500);
            CloudSystem.MaxDepthCloud = EditorGUILayout.IntSlider("  Depth: ", CloudSystem.MaxDepthCloud, 5, 1000);
            CloudSystem.FixedSize     = EditorGUILayout.Toggle("  Fixed Size", CloudSystem.FixedSize);
            EditorGUILayout.Separator();
            CloudSystem.IsAnimate = EditorGUILayout.Toggle("  Animate Cloud", CloudSystem.IsAnimate);
            if (CloudSystem.IsAnimate)
            {
                CloudSystem.AnimationVelocity = EditorGUILayout.Slider("  Animation Velocity: ", CloudSystem.AnimationVelocity, 0, 1);
            }
            CloudSystem.NumberOfShadows = (CloudsToy.TypeShadow)EditorGUILayout.EnumPopup("  Shadows: ", CloudSystem.NumberOfShadows);
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            EditorGUILayout.LabelField("Texture Add", "Used for Bright Clouds");
            EditorGUILayout.BeginHorizontal();
            for (i = 0; i < CloudSystem.CloudsTextAdd.Length; i++)
            {
                if (i == CloudSystem.CloudsTextAdd.Length / 2)
                {
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                }
                else
                if (i != 0 && i != 3)
                {
                    EditorGUILayout.Separator();
                }
                CloudSystem.CloudsTextAdd[i] = (Texture2D)EditorGUILayout.ObjectField(CloudSystem.CloudsTextAdd[i], typeof(Texture2D), GUILayout.Width(70), GUILayout.Height(70));
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            EditorGUILayout.LabelField("Text Blended", "Used for Realistic Clouds");
            EditorGUILayout.BeginHorizontal();
            for (i = 0; i < CloudSystem.CloudsTextBlended.Length; i++)
            {
                if (i == CloudSystem.CloudsTextBlended.Length / 2)
                {
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginHorizontal();
                }
                else
                if (i != 0 && i != 3)
                {
                    EditorGUILayout.Separator();
                }
                CloudSystem.CloudsTextBlended[i] = (Texture2D)EditorGUILayout.ObjectField(CloudSystem.CloudsTextBlended[i], typeof(Texture2D), GUILayout.Width(70), GUILayout.Height(70));
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();
            if (GUI.changed)
            {
                EditorUtility.SetDirty(CloudSystem);
            }
            GUI.changed = false;
            break;


        case 1:
            if (!ProcText)
            {
                CloudSystem.PT1TextureWidth  = EditorGUILayout.IntField("  Texture Width: ", CloudSystem.PT1TextureWidth);
                CloudSystem.PT1TextureHeight = EditorGUILayout.IntField("  Texture Height: ", CloudSystem.PT1TextureHeight);
                if (GUI.changed && ProcText)
                {
                    EditorUtility.SetDirty(CloudSystem);
                }
            }
            GUI.changed = false;
            EditorGUILayout.Separator();
            CloudSystem.PT1TypeNoise = (CloudsToy.NoisePresetPT1)EditorGUILayout.EnumPopup("  Type Noise: ", CloudSystem.PT1TypeNoise);
            EditorGUILayout.Separator();
            CloudSystem.PT1Seed = EditorGUILayout.IntSlider("  Seed: ", CloudSystem.PT1Seed, 1, 10000);
            EditorGUILayout.Separator();
            if (GUI.changed && ProcText)
            {
                CloudSystem.PT1NewRandomSeed();
                EditorUtility.SetDirty(CloudSystem);
            }
            GUI.changed = false;
            CloudSystem.PT1ScaleWidth  = EditorGUILayout.Slider("  Scale Width: ", CloudSystem.PT1ScaleWidth, 0.1f, 50.0f);
            CloudSystem.PT1ScaleHeight = EditorGUILayout.Slider("  Scale Height: ", CloudSystem.PT1ScaleHeight, 0.1f, 50.0f);
            CloudSystem.PT1ScaleFactor = EditorGUILayout.Slider("  Scale Factor: ", CloudSystem.PT1ScaleFactor, 0.1f, 2.0f);
            EditorGUILayout.Separator();
            if (CloudSystem.PT1TypeNoise == CloudsToy.NoisePresetPT1.PerlinCloud)
            {
                CloudSystem.PT1Lacunarity       = EditorGUILayout.Slider("  Lacunarity: ", CloudSystem.PT1Lacunarity, 0.0f, 10.0f);
                CloudSystem.PT1FractalIncrement = EditorGUILayout.Slider("  FractalIncrement: ", CloudSystem.PT1FractalIncrement, 0.0f, 2.0f);
                CloudSystem.PT1Octaves          = EditorGUILayout.Slider("  Octaves: ", CloudSystem.PT1Octaves, 0.0f, 10.0f);
                CloudSystem.PT1Offset           = EditorGUILayout.Slider("  Offset: ", CloudSystem.PT1Offset, 0.1f, 3.0f);
            }
            else
            if (CloudSystem.PT1TypeNoise == CloudsToy.NoisePresetPT1.Cloud)
            {
                CloudSystem.PT1TurbSize  = EditorGUILayout.IntSlider("  Turb Size: ", CloudSystem.PT1TurbSize, 1, 256);
                CloudSystem.PT1TurbLacun = EditorGUILayout.Slider("  Turb Lacun: ", CloudSystem.PT1TurbLacun, 0.01f, 0.99f);
                CloudSystem.PT1TurbGain  = EditorGUILayout.Slider("  Turb Gain: ", CloudSystem.PT1TurbGain, 0.01f, 2.99f);
                CloudSystem.PT1xyPeriod  = EditorGUILayout.Slider("  Radius: ", CloudSystem.PT1xyPeriod, 0.1f, 2.0f);
                CloudSystem.PT1turbPower = EditorGUILayout.Slider("  Turb Power: ", CloudSystem.PT1turbPower, 1, 60);
            }
            EditorGUILayout.Separator();

            /*CloudSystem.PT1IsHalo = EditorGUILayout.Toggle("  Halo Active:", CloudSystem.PT1IsHalo);
             * if(CloudSystem.PT1IsHalo)*/
            CloudSystem.PT1HaloEffect       = EditorGUILayout.Slider("  HaloEffect: ", CloudSystem.PT1HaloEffect, 0.1f, 1.7f);
            CloudSystem.PT1HaloInsideRadius = EditorGUILayout.Slider("  Inside Radius: ", CloudSystem.PT1HaloInsideRadius, 0.1f, 3.5f);
            EditorGUILayout.Separator();

            /*CloudSystem.PT1BackgroundColor = EditorGUILayout.ColorField("  Back Color: ", CloudSystem.PT1BackgroundColor);
             * CloudSystem.PT1FinalColor = EditorGUILayout.ColorField("  Front Color: ", CloudSystem.PT1FinalColor);*/
            CloudSystem.PT1InvertColors = EditorGUILayout.Toggle("  Invert Colors:", CloudSystem.PT1InvertColors);
            CloudSystem.PT1ContrastMult = EditorGUILayout.Slider("  Contrast Mult: ", CloudSystem.PT1ContrastMult, 0.0f, 2.0f);
            EditorGUILayout.Separator();
            CloudSystem.PT1UseAlphaTexture = EditorGUILayout.Toggle("  Alpha Texture:", CloudSystem.PT1UseAlphaTexture);
            if (CloudSystem.PT1UseAlphaTexture)
            {
                CloudSystem.PT1AlphaIndex = EditorGUILayout.Slider("  Alpha Index: ", CloudSystem.PT1AlphaIndex, 0.0f, 1.0f);
            }
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            // Be sure that the Texture1 class exists before try to paint the textures.
            if (ProcText)
            {
                MyWidth = EditorGUILayout.IntSlider("  BoxDraw Text: ", MyWidth, 50, 200);
                EditorGUILayout.Separator();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.Space();
                ProcText.MyTexture = (Texture2D)EditorGUILayout.ObjectField(ProcText.MyTexture, typeof(Texture2D), GUILayout.Width(MyWidth), GUILayout.Height(MyWidth));
                EditorGUILayout.Separator();
                EditorGUILayout.Space();
                if (CloudSystem.PT1UseAlphaTexture)
                {
                    ProcText.MyAlphaDrawTexture = (Texture2D)EditorGUILayout.ObjectField(ProcText.MyAlphaDrawTexture, typeof(Texture2D), GUILayout.Width(MyWidth), GUILayout.Height(MyWidth));
                }
                EditorGUILayout.Separator();
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
            }

            Rect buttonRectPT1 = EditorGUILayout.BeginHorizontal();
            buttonRectPT1.x      = buttonRectPT1.width / 2 - 100;
            buttonRectPT1.width  = 200;
            buttonRectPT1.height = 30;
            //GUI.skin??
            if (GUI.Button(buttonRectPT1, "Reset Parameters"))
            {
                CloudSystem.ResetCloudParameters();
                if (ProcText)
                {
                    CloudSystem.PT1CopyParameters();
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            // Is the program being executed? If so, show the 'Save Params' button.
            if (ProcText)
            {
                Rect buttonRectPrint = EditorGUILayout.BeginHorizontal();
                buttonRectPrint.x      = buttonRectPrint.width / 2 - 100;
                buttonRectPrint.width  = 200;
                buttonRectPrint.height = 30;
                //GUI.skin??
                if (GUI.Button(buttonRectPrint, "Save Texture"))
                {
                    CloudSystem.SaveProceduralTexture();
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            if (GUI.changed)
            {
                if (ProcText)
                {
                    CloudSystem.PT1CopyParameters();
                    CloudSystem.ModifyPTMaterials();
                }
                EditorUtility.SetDirty(CloudSystem);
            }
            GUI.changed = false;

            break;
        }
        EditorGUILayout.EndVertical();
    }