43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
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;
|
|
}
|
|
} |