コード例 #1
0
 public void DebugLevelUp()
 {
     if (hero != null)
     {
         hero.AddExperience(500020);
     }
     UpdateWindow();
 }
コード例 #2
0
ファイル: XpStockPanel.cs プロジェクト: v-duong/HeroTowerGame
    public void OnConfirmClick()
    {
        if (selectedHero == null)
        {
            return;
        }
        int requiredExperience = Helpers.GetRequiredExperience(selectedLevel) - selectedHero.Experience;

        if (requiredExperience > GameManager.Instance.PlayerStats.ExpStock)
        {
            return;
        }
        GameManager.Instance.PlayerStats.ModifyExpStock(-requiredExperience);
        selectedHero.AddExperience(requiredExperience);

        SaveManager.CurrentSave.SaveHeroData(selectedHero);
        SaveManager.CurrentSave.SavePlayerData();
        SaveManager.Save();

        UpdateSliderValues();
        UpdatePanels();
    }