/// <summary> /// Creates <see cref="PlayerValuable.GeneratePlayerValuableEvent"/>s that increment simple counters. /// </summary> /// <param name="playerValuables"></param> /// <returns>A dictionary linking <see cref="ValuableType"/>s to the number of times their respective <see cref="PlayerValuable.GeneratePlayerValuableEvent"/>s were triggered (<see cref="ValuableGenerationCounter.Events"/>) and the number of <see cref="PlayerValuable"/>s that were generated by those events (<see cref="ValuableGenerationCounter.Amount"/>)</returns> private static Dictionary <ValuableType, ValuableGenerationCounter> CreateValuableGenerationCounters( KeyedList <ValuableType, PlayerValuable> playerValuables) { var generateCounters = playerValuables.ToDictionary( playerValuable => playerValuable.ValuableType, playerValuable => new ValuableGenerationCounter() ); PlayerValuable.GeneratePlayerValuableEvent += (valuable, amount) => { generateCounters[valuable.ValuableType].Events += 1; generateCounters[valuable.ValuableType].Amount += amount; }; return(generateCounters); }