Пример #1
0
        void Start()
        {
            _player = PlayerManager.Load();
            Music.isOn = _player.IsMusicEnabled;
            Sound.isOn = _player.IsSoundEnabled;

            Music.onValueChanged.AddListener(SaveChanges);
            Sound.onValueChanged.AddListener(SaveChanges);
        }
Пример #2
0
        public static void Reset(bool makeNew = false)
        {
            var oldPlayer = makeNew ? new PlayerModel() : Load();

            var player = new PlayerModel
            {
                Money = 0,
                IsSoundEnabled = oldPlayer == null || oldPlayer.IsSoundEnabled,
                IsMusicEnabled = oldPlayer == null || oldPlayer.IsMusicEnabled
            };
            Save(player);
        }
Пример #3
0
 public static void Save(PlayerModel player)
 {
     var manager = new XmlManager<PlayerModel>();
     manager.Save(SaveGameFile, player);
 }
Пример #4
0
 public void init()
 {
     player = new PlayerModel();
     enemy = new PlayerModel();
     inited = true;
 }