Esempio n. 1
0
 /// <summary>
 /// Creates a float attribute with given key and value<br/>
 /// Side note: If you need this attribute to be compatible with deserialized json - use SetDouble()
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 public virtual void SetFloat(string key, float value)
 {
     lock (attributesLock)
     {
         attributes[key] = new FloatAttribute(value);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Retrieves a float or defaultvalue if key is not found
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public virtual float GetFloat(string key, float defaultValue = 0)
        {
            FloatAttribute attr = attributes.TryGetValue(key) as FloatAttribute;

            return(attr == null ? defaultValue : attr.value);
        }