示例#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;
 }
示例#2
0
        /// <summary>
        /// Callback to manage changes to the type preset slider.
        /// </summary>
        /// <param name="field">Field that changed (unused).</param>
        /// <param name="oldFieldValueObj">Previous value (unused).</param>
        private void TypePresetChanged(BaseField field, object oldFieldValueObj)
        {
            TypePreset newtype = presetTypes[typePreset];

            FlashOn         = newtype.flashOn;
            FlashOff        = newtype.flashOff;
            Interval        = newtype.interval;
            Intensity       = newtype.intensity;
            Range           = newtype.range;
            actualEnergyReq = EnergyReq * Mathf.Max(0.25f, Intensity * Intensity);

            if (applySymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    ModuleNavLight ml = p.FindModuleImplementing <ModuleNavLight>();
                    if (ml != null) // shouldn't ever be null?
                    {
                        ml.FlashOn   = FlashOn;
                        ml.FlashOff  = FlashOff;
                        ml.Interval  = Interval;
                        ml.Intensity = Intensity;
                        ml.Range     = Range;
                    }
                }
            }
        }
示例#3
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;
 }
示例#4
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;
 }
示例#5
0
        // 로드할 때의 함수. 저장된 txt 파일에서 파싱하자
        public void ParseType(string typeName, int index)
        {
            TypePreset typePreset = new TypePreset(index, typeName);

            _typePreset_ByName.Add(typeName, typePreset);
            _typePreset_ByIndex.Add(index, typePreset);
        }
示例#6
0
        public string GetTypeName(int index)
        {
            TypePreset typePreset = GetTypePreset(index);

            if (typePreset == null)
            {
                Debug.LogError("GetTypeName 실패 [" + index + "]");
                return(null);
            }
            return(typePreset._typeName);
        }
示例#7
0
        // Get (Name, Index 각각)
        public int GetTypeIndex(string typeName)
        {
            TypePreset typePreset = GetTypePreset(typeName);

            if (typePreset == null)
            {
                Debug.LogError("GetTypeIndex 실패 [" + typeName + "]");
                return(-1);
            }
            return(typePreset._index);
        }
示例#8
0
        public bool FileRead(StreamReader sr)
        {
            Clear();

            string curText = "";

            try
            {
                curText = sr.ReadLine();                 // "-----"
                if (curText.Contains("-"))
                {
                    //라인이 입력되었다.
                    //한줄 더 읽자
                    curText = sr.ReadLine();
                }
                int nTypes = int.Parse(curText);

                curText = sr.ReadLine();
                int nFields = int.Parse(curText);

                for (int i = 0; i < nTypes; i++)
                {
                    ParseIndexString(sr.ReadLine());
                    TypePreset typePreset = new TypePreset(_parseUnit.index, _parseUnit.strValue);
                    _typePreset_ByIndex.Add(typePreset._index, typePreset);
                    _typePreset_ByName.Add(typePreset._typeName, typePreset);

                    _parsedTypes.Add(typePreset._typeName, Type.GetType(typePreset._typeName));
                }

                for (int i = 0; i < nFields; i++)
                {
                    ParseIndexString(sr.ReadLine());
                    FieldPreset fieldPreset = new FieldPreset(_parseUnit.index, _parseUnit.strValue);
                    _fieldPreset_ByIndex.Add(fieldPreset._index, fieldPreset);
                    _fieldPreset_ByName.Add(fieldPreset._fieldName, fieldPreset);
                }

                sr.ReadLine();                 // "-----"
            }
            catch (Exception ex)
            {
                Debug.LogError("Backup Table FileRead Exception : " + ex);
                return(false);
            }

            return(true);
        }
示例#9
0
        // Set
        //-----------------------------------------------------------
        // 저장할때의 함수. BackupUnit에서 값을 받자
        public int AddTypeName(string typeName)
        {
            TypePreset typePreset = GetTypePreset(typeName);

            if (typePreset == null)
            {
                TypePreset newPreset = new TypePreset(_nextIndex_Type, typeName);
                _typePreset_ByName.Add(typeName, newPreset);
                _typePreset_ByIndex.Add(_nextIndex_Type, newPreset);

                _nextIndex_Type++;

                return(newPreset._index);
            }

            return(typePreset._index);
        }
示例#10
0
        /// <summary>
        /// For the editor, load the color presets so the player can adjust colors in the VAB.
        /// </summary>
        private void SetupChooser()
        {
            if (Tweakable)
            {
                ConfigNode[]  colorPresetNodes = GameDatabase.Instance.GetConfigNodes("AVIATION_LIGHTS_PRESET_COLORS");
                List <string> colorNames       = new List <string>();
                presetColorValues = new List <Vector3>();
                for (int presetNode = 0; presetNode < colorPresetNodes.Length; ++presetNode)
                {
                    ConfigNode[] colors = colorPresetNodes[presetNode].GetNodes("Color");
                    for (int colorIndex = 0; colorIndex < colors.Length; ++colorIndex)
                    {
                        string  guiName = string.Empty;
                        Vector3 value   = new Vector3(0.0f, 0.0f, 0.0f);
                        if (colors[colorIndex].TryGetValue("guiName", ref guiName) && colors[colorIndex].TryGetValue("value", ref value))
                        {
                            if (colorNames.Contains(guiName) == false)
                            {
                                colorNames.Add(guiName);
                                value.x = Mathf.Clamp01(value.x);
                                value.y = Mathf.Clamp01(value.y);
                                value.z = Mathf.Clamp01(value.z);
                                presetColorValues.Add(value);
                            }
                        }
                    }
                }

                BaseField chooseField = Fields["colorPreset"];
                if (colorNames.Count > 0)
                {
                    UI_ChooseOption chooseOption = (UI_ChooseOption)chooseField.uiControlEditor;
                    chooseOption.options        = colorNames.ToArray();
                    chooseOption.onFieldChanged = ColorPresetChanged;
                }
                else
                {
                    // No colors?  No preset slider.
                    chooseField.guiActiveEditor = false;
                }

                ConfigNode[]  typePresetNodes = GameDatabase.Instance.GetConfigNodes("AVIATION_LIGHTS_PRESET_TYPES");
                List <string> presetNames     = new List <string>();
                presetTypes = new List <TypePreset>();
                for (int presetNode = 0; presetNode < typePresetNodes.Length; ++presetNode)
                {
                    ConfigNode[] types = typePresetNodes[presetNode].GetNodes("Type");
                    for (int typeIndex = 0; typeIndex < types.Length; ++typeIndex)
                    {
                        string guiName = string.Empty;
                        float  flashOn = 0.0f, flashOff = 0.0f, interval = 0.0f, intensity = 0.0f, range = 0.0f;
                        if (types[typeIndex].TryGetValue("guiName", ref guiName) &&
                            types[typeIndex].TryGetValue("flashOn", ref flashOn) &&
                            types[typeIndex].TryGetValue("flashOff", ref flashOff) &&
                            types[typeIndex].TryGetValue("interval", ref interval) &&
                            types[typeIndex].TryGetValue("intensity", ref intensity) &&
                            types[typeIndex].TryGetValue("range", ref range))
                        {
                            if (presetNames.Contains(guiName) == false)
                            {
                                presetNames.Add(guiName);

                                TypePreset type = new TypePreset();
                                type.flashOn   = Mathf.Max(flashOn, 0.0f);
                                type.flashOff  = Mathf.Max(flashOff, 0.0f);
                                type.interval  = Mathf.Max(interval, 0.0f);
                                type.intensity = Mathf.Clamp(intensity, 0.0f, 8.0f);
                                type.range     = Mathf.Max(range, 0.0f);

                                presetTypes.Add(type);
                            }
                        }
                    }
                }

                chooseField = Fields["typePreset"];
                if (presetNames.Count > 0)
                {
                    UI_ChooseOption chooseOption = (UI_ChooseOption)chooseField.uiControlEditor;
                    chooseOption.options        = presetNames.ToArray();
                    chooseOption.onFieldChanged = TypePresetChanged;
                }
                else
                {
                    // No types?  No preset slider.
                    chooseField.guiActiveEditor = false;
                }

                chooseField = Fields["Intensity"];
                UI_FloatRange floatRange = (UI_FloatRange)chooseField.uiControlEditor;
                floatRange.onFieldChanged = ValueChanged;

                chooseField = Fields["Range"];
                floatRange  = (UI_FloatRange)chooseField.uiControlEditor;
                floatRange.onFieldChanged = ValueChanged;

                chooseField = Fields["lightR"];
                floatRange  = (UI_FloatRange)chooseField.uiControlEditor;
                floatRange.onFieldChanged = ValueChanged;

                chooseField = Fields["lightG"];
                floatRange  = (UI_FloatRange)chooseField.uiControlEditor;
                floatRange.onFieldChanged = ValueChanged;

                chooseField = Fields["lightB"];
                floatRange  = (UI_FloatRange)chooseField.uiControlEditor;
                floatRange.onFieldChanged = ValueChanged;

                chooseField = Fields["spotLight"];
                chooseField.guiActiveEditor = (SpotAngle > 0.0f);
                UI_Toggle toggle = (UI_Toggle)chooseField.uiControlEditor;
                toggle.onFieldChanged = ValueChanged;
            }
            else
            {
                // The module is configured as non-Tweakable.  Remove the config options from the editor.
                Fields["colorPreset"].guiActiveEditor = false;
                Fields["typePreset"].guiActiveEditor  = false;
                Fields["Intensity"].guiActiveEditor   = false;
                Fields["Range"].guiActiveEditor       = false;
                Fields["lightR"].guiActiveEditor      = false;
                Fields["lightG"].guiActiveEditor      = false;
                Fields["lightB"].guiActiveEditor      = false;
            }
        }
示例#11
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();
            }
        }
    }
示例#12
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();
        }
    }
示例#13
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;
 }
示例#14
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;
 }
示例#15
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;
 }