Пример #1
0
    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);
    }
Пример #2
0
    private void InitFloatStats()
    {
        FloatStats = new ActorStatsToFloatDictionary();

        FloatStats.Add(ActorStatsDeclaration.Speed, 1);
    }