public List <TypeDetail> GetAllTypes()
        {
            String         sqlSelect = "SELECT * FROM Type_Detail";
            SqlDataAdapter daTypes   = new SqlDataAdapter(sqlSelect, new SqlConnection(connectionString));

            DataSet dsTypes = new DataSet();

            daTypes.Fill(dsTypes, "Type_Detail");

            Dictionary <String, TypeDetail> dictionary = new Dictionary <String, TypeDetail>();
            TypeDetail typeDetail = null;

            foreach (DataRow row in dsTypes.Tables["Type_Detail"].Rows)
            {
                int id = Int32.Parse(row["id_type_detail"].ToString());
                if (dictionary.ContainsKey(id + "") == false)
                {
                    typeDetail = new TypeDetail();
                    typeDetail.IdTypeDetail = id;
                    typeDetail.Description  = row["description"].ToString();
                    dictionary.Add(id + "", typeDetail);
                } //if
            }     //for
            return(dictionary.Values.ToList <TypeDetail>());
        }         //getAll
Пример #2
0
 public void  SetCloudDetailParams()
 {
     if (CloudDetailAnt == CloudDetail)
     {
         return;
     }
     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;
     }
     CloudDetailAnt = CloudDetail;
 }
Пример #3
0
        public static Detail GetDetail(string filePath, TypeDetail type)
        {
            using (var str = new StreamReader(filePath, Encoding.UTF8))
            {
                var info = new FileInfo(filePath);

                var fileText = str.ReadToEnd();
                var mas      = fileText.Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);

                var resultK = new List <double[]>();

                foreach (var item in mas)
                {
                    var masK = item.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    var k    = new double[masK.Length];

                    for (int i = 0; i < masK.Length; i++)
                    {
                        k[i] = Convert.ToDouble(masK[i]);
                    }

                    resultK.Add(k);
                }

                return(new Detail(resultK, info.Name, type));
            }
        }
        public IHttpActionResult PutTypeDetail(int id, TypeDetail typeDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != typeDetail.TypeId)
            {
                return(BadRequest());
            }

            db.Entry(typeDetail).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TypeDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #5
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;
 }
Пример #6
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;
 }
Пример #7
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;
 }
Пример #8
0
        public Detail(List <double[]> standarts, string nameObject, TypeDetail type)
        {
            var del = (int)(standarts.Count * 0.8);

            var setStandart = new List <double[]>();

            switch (type)
            {
            case TypeDetail.All:
                setStandart = standarts;
                break;

            case TypeDetail.Train:
                setStandart = standarts.GetRange(0, del);
                break;

            case TypeDetail.Test:
                setStandart = standarts.GetRange(del - 1, standarts.Count - del);
                break;

            default:
                break;
            }

            _standartsLearn = setStandart;
            _nameObject     = nameObject.Substring(0, nameObject.LastIndexOf('.'));
            _countError     = 0;
        }
Пример #9
0
 public int CountVoterOfTypeDetail(long voterCode, TypeDetail typeDetail)
 {
     if (DB.ValueToTypes.Any(v => v.VoterCode == voterCode && v.TypeDetailsId == typeDetail.TypeDetailsId))
     {
         return(DB.ValueToTypes.Count(v => v.VoterCode == voterCode && v.TypeDetailsId == typeDetail.TypeDetailsId));
     }
     return(0);
 }
Пример #10
0
        public ActionResult DeleteConfirmed(int id)
        {
            TypeDetail typeDetail = db.TypeDetails.Find(id);

            db.TypeDetails.Remove(typeDetail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #11
0
 public void AddNewTypeDetail(TypeDetail newTypeDetail)
 {
     if (!(DB.TypeDetails.Any(t => t.TypeDetailsName == newTypeDetail.TypeDetailsName && t.TypeId == newTypeDetail.TypeId)))
     {
         DB.TypeDetails.Add(newTypeDetail);
         DB.SaveChanges();
     }
     Console.WriteLine("פריט סיווג זה קיים לבחירות אלו");
 }
Пример #12
0
        public void AddNewTypeDetail(string typeDetail, string type, long electionId)
        {
            int        typeId        = TypeBL.GetTypeIdByName(type, electionId);
            TypeDetail newTypeDetail = new TypeDetail()
            {
                TypeDetailsName = typeDetail, TypeId = typeId
            };

            TypeDetailsDal.AddNewTypeDetail(newTypeDetail);
        }
Пример #13
0
 public ActionResult Edit([Bind(Include = "TypeId,TypeCode,TypeName,DetailName")] TypeDetail typeDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(typeDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(typeDetail));
 }
Пример #14
0
        internal ModelDetail(TypeDetail typeDetails)
        {
            this.Type = typeDetails.Type;
            while (typeDetails.InnerTypes.Count == 1)
            {
                this.Type   = typeDetails.InnerTypes[0];
                typeDetails = typeDetails.InnerTypeDetails[0];
            }

            var sourceEntityAttribute = typeDetails.Attributes.Select(x => x as EntityAttribute).Where(x => x != null).FirstOrDefault();

            this.IsDataSourceEntity = sourceEntityAttribute != null;
            if (this.IsDataSourceEntity)
            {
                this.DataSourceEntityName = sourceEntityAttribute.StoreName;
                if (String.IsNullOrWhiteSpace(this.DataSourceEntityName))
                {
                    this.DataSourceEntityName = this.Type.Name;
                }
                if (!this.DataSourceEntityName.All(x => char.IsLetterOrDigit(x) || x == '_' || x == '`'))
                {
                    throw new ArgumentException(String.Format("{0}.{1}={2}", nameof(EntityAttribute), nameof(EntityAttribute.StoreName), this.DataSourceEntityName));
                }
            }

            var modelProperties = new List <ModelPropertyDetail>();

            foreach (var member in typeDetails.MemberDetails)
            {
                var notSourcePropertyAttribute = member.Attributes.Select(x => x as StoreExcludeAttribute).Where(x => x != null).FirstOrDefault();
                if (notSourcePropertyAttribute == null)
                {
                    var modelPropertyInfo = new ModelPropertyDetail(member, this.IsDataSourceEntity);
                    modelProperties.Add(modelPropertyInfo);
                }
            }

            this.Name       = typeDetails.Type.Name;
            this.Properties = modelProperties.ToArray();

            this.propertiesByName                      = this.Properties.ToDictionary(x => x.Name);
            this.propertiesByNameLower                 = this.Properties.ToDictionary(x => x.Name.ToLower());
            this.IdentityProperties                    = this.Properties.Where(x => x.IsIdentity).ToArray();
            this.IdentityAutoGeneratedProperties       = this.Properties.Where(x => x.IsIdentity && x.IsIdentityAutoGenerated).ToArray();
            this.RelatedProperties                     = this.Properties.Where(x => x.IsRelated).ToArray();
            this.RelatedEnumerableProperties           = this.Properties.Where(x => x.IsRelated && x.IsEnumerable).ToArray();
            this.RelatedNonEnumerableProperties        = this.Properties.Where(x => x.IsRelated && !x.IsEnumerable).ToArray();
            this.NonAutoGeneratedNonRelationProperties = this.Properties.Where(x => !x.IsIdentityAutoGenerated && !x.IsRelated).ToArray();

            this.Creator = typeDetails.Creator;
            if (this.Creator == null)
            {
                throw new Exception($"{Type.Name} must have a parameterless constructor to be a model.");
            }
        }
Пример #15
0
        public ActionResult Create([Bind(Include = "TypeId,TypeCode,TypeName,DetailName")] TypeDetail typeDetail)
        {
            if (ModelState.IsValid)
            {
                db.TypeDetails.Add(typeDetail);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(typeDetail));
        }
Пример #16
0
        private static void SetValue <T>(TypeDetail typeDetail, T model, string name, string value)
        {
            if (!typeDetail.TryGetMemberCaseInsensitive(name, out MemberDetail member))
            {
                return;
            }

            var convertedValue = TypeAnalyzer.Convert(value, member.Type);

            member.Setter(model, convertedValue);
        }
Пример #17
0
        public static List <T> GetDetails <T>(string[] filesPath, TypeDetail type) where T : class
        {
            var details = new List <T>();

            foreach (var file in filesPath.OrderBy(s => s))
            {
                details.Add((T)(object)GetDetail(file, type));
            }

            return(details);
        }
        public IHttpActionResult GetTypeDetail(int id)
        {
            TypeDetail typeDetail = db.TypeDetails.Find(id);

            if (typeDetail == null)
            {
                return(NotFound());
            }

            return(Ok(typeDetail));
        }
        public IHttpActionResult PostTypeDetail(TypeDetail typeDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TypeDetails.Add(typeDetail);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = typeDetail.TypeId }, typeDetail));
        }
        public IHttpActionResult DeleteTypeDetail(int id)
        {
            TypeDetail typeDetail = db.TypeDetails.Find(id);

            if (typeDetail == null)
            {
                return(NotFound());
            }

            db.TypeDetails.Remove(typeDetail);
            db.SaveChanges();

            return(Ok(typeDetail));
        }
Пример #21
0
        // GET: TypeDetail/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TypeDetail typeDetail = db.TypeDetails.Find(id);

            if (typeDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(typeDetail));
        }
Пример #22
0
    public static Type GetTypeByDetail(TypeDetail typeDetail)
    {
        Type ttt;

        switch (typeDetail)
        {
        case TypeDetail.plus:
            ttt = Type.Normal;
            break;

        case TypeDetail.minus:
            ttt = Type.Normal;
            break;

        case TypeDetail.boss:
            ttt = Type.Event;
            break;

        case TypeDetail.trap:
            ttt = Type.Event;
            break;

        case TypeDetail.lucky:
            ttt = Type.Event;
            break;

        case TypeDetail.shop:
            ttt = Type.Special;
            break;

        case TypeDetail.unique:
            ttt = Type.Special;
            break;

        case TypeDetail.shortcutIn:
            ttt = Type.Special;
            break;

        case TypeDetail.shortcutOut:
            ttt = Type.Special;
            break;

        default:
            ttt = Type.None;
            break;
        }
        return(ttt);
    }
Пример #23
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);
        }
    }
Пример #24
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();
        }
    }
Пример #25
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;
 }
Пример #26
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;
 }
Пример #27
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;
 }
Пример #28
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();
            }
        }
    }
Пример #29
0
 public int CountVoterOfTypeDetail(long voterCode, TypeDetail typeDetail)
 {
     return(ValueToTypeDal.CountVoterOfTypeDetail(voterCode, typeDetail));
 }
Пример #30
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);
            }
        }
    }
Пример #31
0
 public void SetCloudDetailParams()
 {
     if(CloudDetailAnt == CloudDetail)
     return;
     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;
     }
     CloudDetailAnt = CloudDetail;
 }