/// <summary> /// Reserves room for the given statistic. /// </summary> public T Add <T>(StatisticIdentifier <T> descriptor) where T : IStatistic, new() { var stat = descriptor.Create(this); _knownStatistics[descriptor.LocalId] = stat; return(stat); }
/// <summary> /// Attempts to retrieve the given statistic, returning null if it was not found. /// </summary> public T TryGetStatistic <T>(StatisticIdentifier <T> identifier) where T : IStatistic, new() { if (!_knownStatistics.TryGetValue(identifier.LocalId, out var stat)) { return(default(T)); } return((T)stat); }
public T TryGetStatistic <T>(StatisticIdentifier <T> identifier) where T : IStatistic, new() { return(default(T)); }