Ejemplo n.º 1
0
 public void  SetPresetFantasy()
 {
     if (CloudPresetAnt == CloudPreset)
     {
         return;
     }
     CloudRender  = TypeRender.Bright;
     CloudDetail  = TypeDetail.Low;
     EmissionMult = 0.3f;
     SetCloudDetailParams();
     TypeClouds   = Type.Nimbus4;
     SoftClouds   = false;
     SpreadDir    = new Vector3(-1, 0, 0);
     LengthSpread = 1;
     NumberClouds = 200;
     //Side = new Vector3(2000, 500, 2000);
     DisappearMultiplier = 2;
     MaximunVelocity     = new Vector3(-10, 0, 0);
     VelocityMultipier   = 0.50f;
     PaintType           = TypePaintDistr.Random;
     CloudColor          = new Color(1, 1, 1, 0.5f);
     MainColor           = new Color(1, 0.62f, 0, 1);
     SecondColor         = new Color(0.5f, 0.5f, 0.5f, 1);
     TintStrength        = 50;
     offset          = 0.2f;
     MaxWithCloud    = 200;
     MaxTallCloud    = 50;
     MaxDepthCloud   = 200;
     FixedSize       = true;
     NumberOfShadows = TypeShadow.Some;
     CloudPresetAnt  = CloudPreset;
 }
Ejemplo n.º 2
0
 public void  SetPresetStormy()
 {
     if (CloudPresetAnt == CloudPreset)
     {
         return;
     }
     CloudRender = TypeRender.Realistic;
     CloudDetail = TypeDetail.Normal;
     SetCloudDetailParams();
     TypeClouds   = Type.Nimbus2;
     SoftClouds   = false;
     SpreadDir    = new Vector3(-1, 0, 0);
     LengthSpread = 1;
     NumberClouds = 100;
     //Side = new Vector3(2000, 500, 2000);
     DisappearMultiplier = 2;
     MaximunVelocity     = new Vector3(-10, 0, 0);
     VelocityMultipier   = 0.85f;
     PaintType           = TypePaintDistr.Below;
     CloudColor          = new Color(1, 1, 1, 0.5f);
     MainColor           = new Color(0.62f, 0.62f, 0.62f, 0.3f);
     SecondColor         = new Color(0.31f, 0.31f, 0.31f, 1);
     TintStrength        = 80;
     offset          = 0.8f;
     MaxWithCloud    = 200;
     MaxTallCloud    = 50;
     MaxDepthCloud   = 200;
     FixedSize       = false;
     NumberOfShadows = TypeShadow.Some;
     CloudPresetAnt  = CloudPreset;
 }
Ejemplo n.º 3
0
 public void  SetPresetSunrise()
 {
     if (CloudPresetAnt == CloudPreset)
     {
         return;
     }
     CloudRender = TypeRender.Bright;
     CloudDetail = TypeDetail.Low;
     SetCloudDetailParams();
     EmissionMult   = 1.6f;
     SizeFactorPart = 1.5f;
     TypeClouds     = Type.Cirrus1;
     SoftClouds     = true;
     SpreadDir      = new Vector3(-1, 0, 0);
     LengthSpread   = 4;
     NumberClouds   = 135;
     //Side = new Vector3(2000, 500, 2000);
     DisappearMultiplier = 2;
     MaximunVelocity     = new Vector3(-10, 0, 0);
     VelocityMultipier   = 6.2f;
     PaintType           = TypePaintDistr.Below;
     CloudColor          = new Color(1, 1, 1, 1);
     MainColor           = new Color(1, 1, 0.66f, 0.5f);
     SecondColor         = new Color(1, 0.74f, 0, 1);
     TintStrength        = 100;
     offset          = 1;
     MaxWithCloud    = 500;
     MaxTallCloud    = 20;
     MaxDepthCloud   = 500;
     FixedSize       = true;
     NumberOfShadows = TypeShadow.None;
     CloudPresetAnt  = CloudPreset;
 }
Ejemplo n.º 4
0
// Change the Material depending on the type of cloud defined by user and the renderer (Bright/Realistic)
// So assign one of the two sets of materials available (Additive or Blended).
    void  AssignCloudMaterial(CloudParticle MyCloudParticle, TypeRender CloudRender, Type TypeClouds)
    {
        ModifyPTMaterials();
        if (CloudRender == TypeRender.Bright)
        {
            if (TypeClouds == Type.Nimbus1)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[0]);
            }
            else
            if (TypeClouds == Type.Nimbus2)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[1]);
            }
            else
            if (TypeClouds == Type.Nimbus3)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[2]);
            }
            else
            if (TypeClouds == Type.Nimbus4)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[3]);
            }
            else
            if (TypeClouds == Type.Cirrus1)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[4]);
            }
            else
            if (TypeClouds == Type.Cirrus2)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[5]);
            }
            else
            if (TypeClouds == Type.MixNimbus)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(0, 4)]);
            }
            else
            if (TypeClouds == Type.MixCirrus)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(4, 6)]);
            }
            else
            if (TypeClouds == Type.MixAll)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(0, 6)]);
            }
            else
            if (TypeClouds == Type.PT1)
            {
                //if(ProceduralTexture.IsInicialized())
                MyCloudParticle.SetMaterial(CloudsPTMatAdditive);
            }
        }
        else
        {
            if (TypeClouds == Type.Nimbus1)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[0]);
            }
            else
            if (TypeClouds == Type.Nimbus2)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[1]);
            }
            else
            if (TypeClouds == Type.Nimbus3)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[2]);
            }
            else
            if (TypeClouds == Type.Nimbus4)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[3]);
            }
            else
            if (TypeClouds == Type.Cirrus1)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[4]);
            }
            else
            if (TypeClouds == Type.Cirrus2)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[5]);
            }
            else
            if (TypeClouds == Type.MixNimbus)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(0, 4)]);
            }
            else
            if (TypeClouds == Type.MixCirrus)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(4, 6)]);
            }
            else
            if (TypeClouds == Type.MixAll)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(0, 6)]);
            }
            else
            if (TypeClouds == Type.PT1)
            {
                //if(ProceduralTexture.IsInicialized())
                MyCloudParticle.SetMaterial(CloudsPTMatBlended);
            }
        }
    }
Ejemplo n.º 5
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);
            }
        }
    }
Ejemplo n.º 6
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();
            }
        }
    }
Ejemplo n.º 7
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();
        }
    }
Ejemplo n.º 8
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);
        }
    }
Ejemplo n.º 9
0
 // Change the Material depending on the type of cloud defined by user and the renderer (Bright/Realistic)
 // So assign one of the two sets of materials available (Additive or Blended).
 void AssignCloudMaterial( CloudParticle MyCloudParticle ,   TypeRender CloudRender ,   Type TypeClouds)
 {
     ModifyPTMaterials();
     if(CloudRender == TypeRender.Bright){
     if(TypeClouds == Type.Nimbus1)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[0]);
     else
     if(TypeClouds == Type.Nimbus2)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[1]);
     else
     if(TypeClouds == Type.Nimbus3)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[2]);
     else
     if(TypeClouds == Type.Nimbus4)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[3]);
     else
     if(TypeClouds == Type.Cirrus1)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[4]);
     else
     if(TypeClouds == Type.Cirrus2)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[5]);
     else
     if(TypeClouds == Type.MixNimbus)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(0, 4)]);
     else
     if(TypeClouds == Type.MixCirrus)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(4, 6)]);
     else
     if(TypeClouds == Type.MixAll)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(0, 6)]);
     else
     if(TypeClouds == Type.PT1)
         //if(ProceduralTexture.IsInicialized())
             MyCloudParticle.SetMaterial(CloudsPTMatAdditive);
     }
     else{
     if(TypeClouds == Type.Nimbus1)
         MyCloudParticle.SetMaterial(CloudsMatBlended[0]);
     else
     if(TypeClouds == Type.Nimbus2)
         MyCloudParticle.SetMaterial(CloudsMatBlended[1]);
     else
     if(TypeClouds == Type.Nimbus3)
         MyCloudParticle.SetMaterial(CloudsMatBlended[2]);
     else
     if(TypeClouds == Type.Nimbus4)
         MyCloudParticle.SetMaterial(CloudsMatBlended[3]);
     else
     if(TypeClouds == Type.Cirrus1)
         MyCloudParticle.SetMaterial(CloudsMatBlended[4]);
     else
     if(TypeClouds == Type.Cirrus2)
         MyCloudParticle.SetMaterial(CloudsMatBlended[5]);
     else
     if(TypeClouds == Type.MixNimbus)
         MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(0, 4)]);
     else
     if(TypeClouds == Type.MixCirrus)
         MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(4, 6)]);
     else
     if(TypeClouds == Type.MixAll)
         MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(0, 6)]);
     else
     if(TypeClouds == Type.PT1)
         //if(ProceduralTexture.IsInicialized())
             MyCloudParticle.SetMaterial(CloudsPTMatBlended);
     }
 }
Ejemplo n.º 10
0
 public void SetPresetSunrise()
 {
     if(CloudPresetAnt == CloudPreset)
     return;
     CloudRender = TypeRender.Bright;
     CloudDetail = TypeDetail.Low;
     SetCloudDetailParams();
     EmissionMult = 1.6f;
     SizeFactorPart = 1.5f;
     TypeClouds = Type.Cirrus1;
     SoftClouds = true;
     SpreadDir = new Vector3(-1, 0, 0);
     LengthSpread = 4;
     NumberClouds = 135;
     //Side = new Vector3(2000, 500, 2000);
     DisappearMultiplier = 2;
     MaximunVelocity = new Vector3(-10, 0, 0);
     VelocityMultipier = 6.2f;
     PaintType = TypePaintDistr.Below;
     CloudColor = new Color(1, 1, 1, 1);
     MainColor = new Color(1, 1, 0.66f, 0.5f);
     SecondColor = new Color(1, 0.74f, 0, 1);
     TintStrength = 100;
     offset = 1;
     MaxWithCloud = 500;
     MaxTallCloud = 20;
     MaxDepthCloud = 500;
     FixedSize = true;
     NumberOfShadows = TypeShadow.None;
     CloudPresetAnt = CloudPreset;
 }
Ejemplo n.º 11
0
 public void SetPresetStormy()
 {
     if(CloudPresetAnt == CloudPreset)
     return;
     CloudRender = TypeRender.Realistic;
     CloudDetail = TypeDetail.Normal;
     SetCloudDetailParams();
     TypeClouds = Type.Nimbus2;
     SoftClouds = false;
     SpreadDir = new Vector3(-1, 0, 0);
     LengthSpread = 1;
     NumberClouds = 100;
     //Side = new Vector3(2000, 500, 2000);
     DisappearMultiplier = 2;
     MaximunVelocity = new Vector3(-10, 0, 0);
     VelocityMultipier = 0.85f;
     PaintType = TypePaintDistr.Below;
     CloudColor = new Color(1, 1, 1, 0.5f);
     MainColor = new Color(0.62f, 0.62f, 0.62f, 0.3f);
     SecondColor = new Color(0.31f, 0.31f, 0.31f, 1);
     TintStrength = 80;
     offset = 0.8f;
     MaxWithCloud = 200;
     MaxTallCloud = 50;
     MaxDepthCloud = 200;
     FixedSize = false;
     NumberOfShadows = TypeShadow.Some;
     CloudPresetAnt = CloudPreset;
 }
Ejemplo n.º 12
0
 public void SetPresetFantasy()
 {
     if(CloudPresetAnt == CloudPreset)
     return;
     CloudRender = TypeRender.Bright;
     CloudDetail = TypeDetail.Low;
     EmissionMult = 0.3f;
     SetCloudDetailParams();
     TypeClouds = Type.Nimbus4;
     SoftClouds = false;
     SpreadDir = new Vector3(-1, 0, 0);
     LengthSpread = 1;
     NumberClouds = 200;
     //Side = new Vector3(2000, 500, 2000);
     DisappearMultiplier = 2;
     MaximunVelocity = new Vector3(-10, 0, 0);
     VelocityMultipier = 0.50f;
     PaintType = TypePaintDistr.Random;
     CloudColor = new Color(1, 1, 1, 0.5f);
     MainColor = new Color(1, 0.62f, 0, 1);
     SecondColor = new Color(0.5f, 0.5f, 0.5f, 1);
     TintStrength = 50;
     offset = 0.2f;
     MaxWithCloud = 200;
     MaxTallCloud = 50;
     MaxDepthCloud = 200;
     FixedSize = true;
     NumberOfShadows = TypeShadow.Some;
     CloudPresetAnt = CloudPreset;
 }
        public override void ReadSectionSettings()
        {
            base.ReadSectionSettings();
            try
            {
                this._firstLevel = Convert.ToInt16(base.Section.Settings["FIRST_LEVEL"]);
                this._lastLevel = Convert.ToInt16(base.Section.Settings["LAST_LEVEL"]);
                this._childrenwhenclicked = Convert.ToBoolean(base.Section.Settings["CHILDREN_ACTNODE"]);
                this._requiresjQuery = Convert.ToBoolean(base.Section.Settings["REQUIRES_JQUERY"]);
                this._typerender = (TypeRender)Enum.Parse(typeof(TypeRender), base.Section.Settings["TYPE_RENDER"].ToString());
            }
            catch
            {

            }
        }