 and keep me grounded grounded just like I'm skating so why be staying focused the game it's up for the hi everyone it's crypto grounds here and welcome back to another unity out of game tutorial video this is episode eight and today we're gonna be working on the prestige system so I have a button in the bottom left corner this will be our prestige button and our prestige currency will be golden flash for example and this is our text to display how many golden flasks we have at the moment and when we click this prestige button we'll have a confirmation asking us if we want to prestige we have a yes and a no button so we'll get this all going by the end of this video first I'm going to create a new script so we'll just create an empty and this will be called our prestige and the script itself will be called the prestige manager I'm going to add all of the UI components to this class all right so it's pretty simple just two texts and a game object representing the confirmation so these four methods are the ones we're going to be using today so the first one will be the prestige gains so our prestige equation will go right in here we'll update some UI related stuff and toggle our confirmation and do the actual prestige I also want to quickly mention if you don't know what a prestige system is it's basically a way to reset your progress in exchange for a special currency that will make your game progress faster all right so starting with the first one I will talk more about the math in a separate video but I'm just going to throw a random curved equation into this method so let's just do square root of our flasks and divide this by some number like a thousand so and that's just our equation it's very basic yeah we'll go over the different types of curves you'll be using in different ways to adjust this equation that kind of fits your game but when we do that there is really no progression style in this tutorial example so far so that all depends on what kind of upgrades you add and how many upgrades you have as well so the prestige equation for auto research is going to be completely different than our kind of style here so I'm just gonna convert that to an expression body since it's just a one-liner all right so we have our prestige gains and inside of the update we'll just update our text so and the currency text will be very similar except we need to add a new variable called golden flasks in your data class so let's add that real quick and set that to zero in the constructor I'm going to add using static controller at the top so you can kind of simplify this a bit for toggle prestige confirm it's literally going to be prestige now for the toggle prestige confirm it's literally going to be prestige confirm dot set active explanation mark prestige confirmation dot active self expression body and now for the prestige so this is where we need to reset everything and get our golden flash so first we'll start with that and first we want to add our golden flash before we actually reset anything because this prestige gains is based on our current flash so we'll just do the addition first so we'll add our gains to our current golden flash and then we'll start doing the resetting process which in our case it's pretty much just resetting our upgrades and our flash so all right so don't forget to add system.link at the top because we are creating our new array converting it to a list and we're just resetting all of our upgrades and our flash and we also want to update the upgrade UI as well and we do that right here so it's a very short script but this is all we need to do so first we need to drag our currency text and our gains text and drag our confirmation into here also I created a pop-ups empty game object here which just stretches the entire screen and I'm going to keep all of my pop-ups in here just to keep it a little organized and in here we need to set no to we need to first drag our prestige object into the on click and for no it's just going to toggle the prestige confirm and yes we'll do the actual prestige and close that have the prestige confirm toggle method and also if we were to prestige this menu won't go away so we need to toggle our prestige confirm at the very end as well all right so as you can see based on our flash right now we can get 916 golden flasks right now if you were to prestige everything would be gone but these don't do anything at all so we were to get an upgrade for production you would see that it just doesn't do anything let's say we want our golden flash to affect on how many flasks we get per second so what we can do is create a new method called our prestige effect and this will essentially multiply our flash per second gain and we're pretty much done with that now what is this equation going to be I'm just going to keep it simple and just divide how many golden flasks we have by 100 and we want to add one because the prestige boost will initially start at zero if we didn't have the plus one and that will just make everything zero okay so we want to use this prestige effect method inside of our upgrades manager so in order to access it we need to create a singleton and inside of the awake method which I made private we will set our prestige manager equal to this instance now let's head to our controller script and I might have said upgrades manager but I meant to say controller but basically we have our flasks per second and all we need to do is just multiply our total by our prestige manager dot prestige manager dot prestige effects so we're getting more flasks per second now so just buy a bunch of upgrades and just keep going so you may notice that our productions here aren't exactly accurate if we were to buy one of these we don't get plus one more per second we get around 10 more per second so let's fix that so this will be done inside of our upgrades manager and you can see it's based on a string array so we're going to need to change how this works so inside of the update method we're constantly updating our production UI so before we update the productions UI we're going to have to change the upgrade names array so in order to do that we're going to allow us to do string interpolation and basically multiply our base values by our prestige effect and this does look a bit repetitive and kind of silly but if you want to change how the naming system works that is up to you all right so let's save and go back and see if our labels have been changed all right so now it looks like this which means it does indeed work so if we were to prestige these numbers should update yep however they look ugly so i'm going to call the note extension method so now it looks like this and i think that's good and that is the end of this video if you enjoyed and thought this video was helpful please leave a like and comment your favorite video game in the comment section below if you want to support me and the channel check out the patreon in the description below or you can hit that thanks button which should be right next to the like button anyways i will see you all in episode 8.1 which will be the math explanation between different prestige curves so i'll be comparing different ones and you'll be able to choose which one's best for your game i'll see you all in the next video peace