For AI agents: the complete documentation index is available at /AchEngine/ja/llms.txt, the full documentation bundle is available at /AchEngine/ja/llms-full.txt, and this page is available as Markdown at /AchEngine/ja/usage/managers/player-data.md.

PlayerManager とプレイヤーデータ

PlayerManager は PlayerDataContainerBase<TKey, TValue> を型ごとに保持します。

public class InventoryContainer : PlayerDataContainerBase<int, ItemData>
{
    public InventoryContainer()
    {
        DataKey = nameof(InventoryContainer);
        _dataDic = new Dictionary<int, ItemData>();
    }
}

var player = ServiceLocator.Resolve<PlayerManager>();
player.AddContainer(new InventoryContainer());
var inventory = player.GetContainer<InventoryContainer>();
inventory.Add(101, new ItemData { Id = 101, Name = "Sword" });

保存と読み込みは SaveManager が担当します。