Achievements are being used now in just about every game out there. You can see them across all genres and gaming platforms, achievements are everywhere. They give the player a sense of pride and accomplishment, knowing that they did something so much that they get rewarded for it. Achievements are also a way for players to brag and show off what they've done in their game.
Similar to how we prototyped our stats, we will need to prototype the achievements. The stats will be used to unlock achievements, but not every stat will have an achievement for it. For this reason, we will have fewer achievements than stats, but we will have different levels for each achievement.
Here's a list of the achievements that we will track:
To get things started, create a new C# script and name it AchievementSystem
. Next, let's create our variables:
int achKills, achTotGold, achGoldSpnt, achLvl, achRndsW, achTime; bool getKills, getTotGold, getGoldSpnt, getLvl, getRndsW, getTime;
The integer variables are what we will use to track which level the players are on within that achievement. Achievement levels can be used to allow the player to unlock further achievements of a specific stat. The bool
variables will be used to determine whether the player can continue to unlock more achievement levels of a specific achievement.
The first function that we will add to our achievement system will allow us to reset our achievements to a base value. Add this next function to the script:
void ResetAchievements() { achKills = 0; achTotGold = 0; achGoldSpnt = 0; achLvl = 0; achRndsW = 0; achTime = 0; getKills = true; getTotGold = true; getGoldSpnt = true; getLvl = true; getRndsW = true; getTime = true; }
Within the preceding function, we set all of our achievement level variables to 0
and the bool
variables to true
.
3.147.44.182