Ejemplo n.º 1
0
 public void Init(FxParams _params)
 {
     fxParams = _params;
     colorizer.setColor(_params.color);
     foreach (SpriteRenderer sr in sprites)
     {
         if (sr == null)
         {
             continue;
         }
         sr.color = fxParams.color;
     }
     foreach (ParticleSystem ps in particles)
     {
         if (ps == null)
         {
             continue;
         }
         var m = ps.main;
         m.startColor = fxParams.color;
     }
     foreach (Text sr in texts)
     {
         if (sr == null)
         {
             continue;
         }
         sr.text = fxParams.text;
     }
     if (textMesh != null)
     {
         textMesh.text = fxParams.text;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Makes and returns connection string.
        /// </summary>
        /// <returns>Can not be null.</returns>
        public override string ToString()
        {
            using (var parameters = new FxParams())
            {
                foreach (var element in this.GetValidProperties())
                {
                    var obj  = element.GetValue(this, null);
                    var type = obj.GetType();

                    if (type == typeof(int))
                    {
                        var value = (int)obj;
                        parameters.SetInt32(element.Name, value);
                    }
                    else if (type == typeof(double))
                    {
                        var value = (double)obj;
                        parameters.SetReal(element.Name, value);
                    }
                    else if (type == typeof(string))
                    {
                        var value = (string)obj;
                        parameters.SetString(element.Name, value);
                    }
                    else if (type == typeof(bool))
                    {
                        var value = (bool)obj;
                        parameters.SetBool(element.Name, value);
                    }
                    else
                    {
                        var message = string.Format("Unsupported property type = {0}", type);
                        throw new ArgumentException(message);
                    }
                }

                var result = parameters.ToString();
                return(result);
            }
        }