//public static void LevelUp(){ instance._LevelUp(); } public void _LevelUp() { PlayerPerk perk = player.GetPlayerPerk(); if (perk != null) { for (int i = 0; i < stats.perkUnlockingAtLevelList.Count; i++) { if (level + 1 == stats.perkUnlockingAtLevelList[i].level) { for (int n = 0; n < stats.perkUnlockingAtLevelList[i].perkIDList.Count; n++) { perk.PurchasePerk(stats.perkUnlockingAtLevelList[i].perkIDList[n], false); } break; } } } level += 1; if (level > 1) { player.GainHitPoint(stats.hitPointGain); player.GainEnergy(stats.energyGain); player.GainPerkCurrency(stats.perkCurrencyGain); TDS.PlayerLevelUp(player); TDS.OnGameMessage("level Up!"); } GainExp(); //call the function to make sure if we under level }