using System.Collections.Generic;
using UnityEngine;

public class GameState : MonoBehaviour
{
    // Настройки игрока
    public string PlayerName { get; set; }
    public int Health { get; set; }
    public int Magic { get; set; }
    public int Level { get; set; }

    // Управление
    public bool IsPlayerControlLocked { get; set; }

    // Сюжетные переменные
    private Dictionary<int, int> _storyVariables = new Dictionary<int, int>();

    // Навыки и инвентарь
    public List<int> Skills { get; set; } = new List<int>();
    public Dictionary<int, int> Inventory { get; set; } = new Dictionary<int, int>();

    public void SetGlobalVariable(int address, int value)
    {
        _storyVariables[address] = value;
        Debug.Log($"Set global variable 0x{address:X8} = {value}");
    }

    public int GetGlobalVariable(int address)
    {
        return _storyVariables.TryGetValue(address, out int value) ? value : 0;
    }

    public void Reset()
    {
        _storyVariables.Clear();
        Skills.Clear();
        Inventory.Clear();
        Health = 100;
        Magic = 50;
        Level = 1;
        IsPlayerControlLocked = true;
    }
}