using System.Collections.Generic; using Godot; using Mr.BrickAdventures.scripts.State; namespace Mr.BrickAdventures.Autoloads; /// /// Manages game statistics using GameStateStore. /// public partial class StatisticsManager : Node { /// /// Gets the statistics dictionary from the store. /// private Dictionary GetStats() { return GameStateStore.Instance?.Player.Statistics ?? new Dictionary(); } /// /// Increases a numerical statistic by a given amount. /// public void IncrementStat(string statName, int amount = 1) { var stats = GetStats(); if (stats.TryGetValue(statName, out var currentValue)) { stats[statName] = currentValue + amount; } else { stats[statName] = amount; } } /// /// Sets a statistic to a specific value. /// public void SetStat(string statName, int value) { var stats = GetStats(); stats[statName] = value; } /// /// Gets the value of a statistic. /// public int GetStat(string statName) { var stats = GetStats(); return stats.TryGetValue(statName, out var value) ? value : 0; } /// /// Gets a copy of all statistics. /// public Dictionary GetAllStats() { return new Dictionary(GetStats()); } }