public DataTrackingGrid GetDataGrid(TelemetryDataType type) { if (dataSets.ContainsKey(type)) { return(dataSets[type]); } else { return(null); } }
public void TrackObjectPosition(TelemetryDataType type) { if (dataTrackerEnabled.Value) { DataTrackingGrid dataSet = dataContainer.GetDataGrid(type); Vector3 position = transform.position; int xData = (int)((transform.position.x - gridPosition.Value.transform.position.x) + dataSet.gridProperties.gridGranularity * 0.5f / dataSet.gridProperties.gridGranularity); int zData = (int)((transform.position.z - gridPosition.Value.transform.position.z) + dataSet.gridProperties.gridGranularity * 0.5f / dataSet.gridProperties.gridGranularity); if (dataSet.InsideBounds(xData, zData)) { dataSet.gridData[zData, xData] += dataSet.gridProperties.dataAddStep; if (dataSet.gridData[zData, xData] > dataSet.maxValStored) { dataSet.maxValStored = dataSet.gridData[zData, xData]; } } } }
/// <summary> /// Creates a new instance of <see cref="TelemetryData"/>. /// </summary> /// <param name="category">Category for which this meter is associated.</param> /// <param name="name">Unique name of this meter.</param> /// <param name="type">Type of performance counter, in practice it determines the formula used to calculate each sample.</param> /// <exception cref="ArgumentException"> /// If <paramref name="category"/> is a <see langword="null"/> or empty string. /// <br/>-or-<br/> /// If <paramref name="name"/> is a <see langword="null"/> or empty string. /// </exception> /// <exception cref="InvalidEnumArgumentException"> /// If <paramref name="type"/> is not a valid <see cref="TelemetryDataType"/> value. /// </exception> public TelemetryData(string category, string name, TelemetryDataType type) { if (String.IsNullOrWhiteSpace(category)) { throw new ArgumentException("Category cannot be a null or blank string.", "category"); } if (String.IsNullOrWhiteSpace(name)) { throw new ArgumentException("Name cannot be a null or blank string.", "name"); } if (!Enum.IsDefined(typeof(TelemetryDataType), type)) { throw new InvalidEnumArgumentException("type", (int)type, typeof(TelemetryDataType)); } Category = category; Name = name; }