Exemplo n.º 1
0
        void Start()
        {
            _player = PlayerManager.Load();
            Music.isOn = _player.IsMusicEnabled;
            Sound.isOn = _player.IsSoundEnabled;

            Music.onValueChanged.AddListener(SaveChanges);
            Sound.onValueChanged.AddListener(SaveChanges);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public static void Save(PlayerModel player)
 {
     var manager = new XmlManager<PlayerModel>();
     manager.Save(SaveGameFile, player);
 }
Exemplo n.º 4
0
 public void init()
 {
     player = new PlayerModel();
     enemy = new PlayerModel();
     inited = true;
 }