diff --git a/MrBigsock/Assets/Code/PlayerController.cs b/MrBigsock/Assets/Code/PlayerController.cs index 6fd71277784eba75697aaec4458e9630de9b5ad3..9607dd73958d4355fdfaa2d7359521d0bb51fd40 100644 --- a/MrBigsock/Assets/Code/PlayerController.cs +++ b/MrBigsock/Assets/Code/PlayerController.cs @@ -16,6 +16,11 @@ namespace BigSock { public partial class PlayerController : Character { + public const int SKILL_POINTS_PR_LVL = 3; // Skill points to gain pr level up. + public const int SKILL_POINTS_START = 5; // Skill points to start with. + public const float XP_SCALE_RATE = 3.0f; // Multiplier for xp gain, helps test system while game is tiny. + + public UtilBar utilBar; @@ -280,21 +285,31 @@ namespace BigSock { utilBar?.WithHealth(Convert.ToInt32(HP)); } - public void GainXp(float xp){ - GiveXp(xp); + public void GainXp(float xp) { + GiveXp(xp * XP_SCALE_RATE); CheckXp(); utilBar?.WithXP((int)this.xp); } - private void CheckXp(){ - if(xp > maxXp){ + + /* + Checks for, and handles, level-ups. + */ + private void CheckXp() { + // If the character has leveled up. + if(xp > maxXp) { level += 1; xp -= maxXp; maxXp = (level + 1) * 100; utilBar?.WithXP(maxValue: (int)maxXp); - + SkillPoints += SKILL_POINTS_PR_LVL; } + /* + To-do: + - Maybe not flat skill points pr level. + - Scale differently. (Separate function for getting xp requirement pr level) + */ } } @@ -308,7 +323,7 @@ namespace BigSock { /* The number of skill points the user has at their disposal. */ - public int SkillPoints { get; set; } + public int SkillPoints { get; set; } = SKILL_POINTS_START; /* The amount of points the user has currently spent on each skill.