Ejemplo n.º 1
0
 public PlayerData(int money, string playerName, List <scoreRecord> hs)
 {
     this.money             = money;
     this.playerName        = playerName;
     this.highscores        = hs;
     this.PlayerUpgradeData = UpgradeCenter.GetPlayerUpgradeData();
 }
Ejemplo n.º 2
0
 void LoadData()
 {
     if (File.Exists(Application.persistentDataPath + "/PlayerInfo.panda"))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(Application.persistentDataPath + "/PlayerInfo.panda", FileMode.Open);
         PlayerData      data = (PlayerData)bf.Deserialize(file);
         file.Close();
         Debug.Log("Money in LoadData: " + data.money);
         money      = data.money;
         highscores = data.highscores;
         playerName = data.playerName;
         UpgradeCenter.SetPlayerUpgradeData(data.PlayerUpgradeData);
     }
     else
     {
         AskPlayerName();
     }
     if (highscores == null)
     {
         highscores = new List <scoreRecord>();
         for (int i = 0; i < numberOfScores; i++)
         {
             highscores.Add(new scoreRecord(-5 - 10 * i, "Noob"));
         }
         unlocked[0] = true;
     }
 }
Ejemplo n.º 3
0
 private void Start()
 {
     jumping    = GetComponent <AudioSource>();
     GM         = GameObject.FindWithTag("GameManager").GetComponent <GameManagerEndless>();
     _rigidBody = GetComponent <Rigidbody2D>();
     Anim       = GetComponent <Animator>();
     //soundCenter = GetComponent<PlayerSoundController>();
     _upgradeCenter = UpgradeCenter.GetInstance();
 }