/// <summary>
 /// Add a stat value for reporting.
 /// </summary>
 /// <param name="key">The stat name.</param>
 /// <param name="value">The stat value.</param>
 /// <param name="aggregationMethod">How multiple values should be treated.</param>
 public void AddStat(string key, float value, StatAggregationMethod aggregationMethod)
 {
     using (var msg = new OutgoingMessage())
     {
         msg.WriteString(key);
         msg.WriteFloat32(value);
         msg.WriteInt32((int)aggregationMethod);
         QueueMessageToSend(msg);
     }
 }
Example #2
0
        /// <summary>
        /// Sets one of the float properties of the environment. This data will be sent to Python.
        /// </summary>
        /// <param name="key"> The string identifier of the property.</param>
        /// <param name="value"> The float value of the property.</param>
        public void Set(string key, float value)
        {
            m_FloatProperties[key] = value;
            using (var msgOut = new OutgoingMessage())
            {
                msgOut.WriteString(key);
                msgOut.WriteFloat32(value);
                QueueMessageToSend(msgOut);
            }

            Action <float> action;

            m_RegisteredActions.TryGetValue(key, out action);
            action?.Invoke(value);
        }