private void UpdateFloatStats(float delta) { FloatStatsForThisUpdate.Clear(); foreach (KeyValuePair <ActorStatsDeclaration, float> stat in FloatStats) { FloatStatsForThisUpdate.Add( stat.Key, (StatMutators.ContainsKey(stat.Key))? StatMutators[stat.Key].MutateValue(stat.Value, delta) : stat.Value ); } foreach (KeyValuePair <ActorStatsDeclaration, StatMutatorBus> statMutation in StatMutators) { if (!FloatStatsForThisUpdate.ContainsKey(statMutation.Key)) { FloatStatsForThisUpdate.Add(statMutation.Key, statMutation.Value.MutateValue(0)); } } FloatStats[ActorStatsDeclaration.CurrentHealthPoints] = Mathf.Clamp(Health.CurrentHealth + Health.Regeneration, Health.CurrentHealth, Health.MaxHealth); }
public float GetFloatStatValue(ActorStatsDeclaration stat) { return((FloatStats.ContainsKey(stat)) ? FloatStats[stat] : 0); }