 Hello guys crypto grounds here welcome back to another unity anti matter dimensions video This is episode two and today we're gonna be finishing up the rest of the dimensions and Work on the dimension shift. So that should be interesting I'm also gonna add the scientific notation get that down over with and finish this getting anti matter per second So if you enjoyed this video makes you smash that like button comment down below and all your suggestions feedback and all that So subscribe to my channel if you're new try on those notifications and check out my patreon if you want to support me Or you can join my channel membership if you want to do that and heavy if you're here welcome to the video Thank you for all your motivation And for making such an amazing game anyways, let's get on with it I'd like to start off by thanking my patreons camera Nathan peek that andrew and tommy. Thank you guys very much Anyways, let's get on with it. Okay, so let's hop into uh, let's make a methods i'm gonna make an okay, so The scientific notation method that we did last time Uh, it's gonna be different, right? So let's create a class or an empty script called Uh, i'm gonna call this extendables, right? So what i'm doing here instead of having a method wrap around a variable I'm gonna have it extend it. So I'll show you what that looks like I think this is really cool and helpful and it kind of saves a lot of Uh A lot of typing I guess you can just simply add on to the end of the variable instead Okay, so we are in our extendables, uh, we don't need a mona this doesn't need to be a mona behavior because we are going to Create a namespace instead. Okay, so we're going to call this uh extendables right and Let's rename i'm going to rename the script to methods Okay, but the the namespace is going to be called extendables and the class is going to be Um methods, okay, so we're going to make the scientific notation. So how we do this is public static Uh string No, yeah string Okay, and then we're going to just call this like note or notate. We can just high notate But I think I I don't know we can make this as short as possible. I'm going to do notate. Okay So now what we put in here is this double num. Okay Now we can't use this because we need to make this a static class Okay, now the cool thing is that we will be able to apply this at the end of um our variables if we Uh import this namespace. Okay, so Uh Let's just return an empty string for now. I'll show you how to do this Okay, so let's go to our dimensions Actually, let's start with our game controller first Okay, so at the top you just put using the extendables, right? That's the name of our namespace that we created and now Let's we let's say we want uh, we have our anti matter right here, right? So all you gotta do here Is type in dot notate that is it Now how does this work now? You can't just put this in front of a float, right? So if we have a var Temp equals 4f for floats and then we do Print for example temp Dot notate now. This isn't going to work because this is a float now if we copy and paste this And just change the type to float we can keep the same name as well, which is a nice Uh, what did I do? Oh, oops actually put it outside of this So if we copy and paste this and replace the type as a float We can keep this name here and now we should be able to do it for floats, right? So that's really cool and how we can do this, but we don't need to do that like that So and we're not going to use floats for now Okay, I'm also going to grab the the break infinity stuff real quick Okay, so I'm in my crypto clickers, uh right now But I'm going to copy paste the big double and big double editor. So copy and we're going to go to my assets in window explorer And finder for mac users. Let's see. Where are we? Okay. I'm just like not focused and paste them in here And now we should be able to use break infinity So let's hop in and we don't need any of this. Okay for now. We probably will eventually but we don't need any of this So now we can import using break infinity Perfect. So now we can replace the the doubles that we have and let's just Make that a big double Big double And now you see we can't add big doubles to a double. So we got to change everything else in here So let's import our break infinity namespace And replace all of our variables that are doubles as big doubles Okay, and that should fix itself. Yeah Not that yet. No. Oh, okay. So now we're we got to replace the math functions too or the math methods the math classes So it's big double dot pal instead and honestly what I'm going to do I'm going to type using static break infinity Dot big double because what I'm going to do here is I'm going to get rid of this math dots And now it's using big doubles dot pal by default without having to type big double dot pal So you see now this is grayed out. I mean, that's redundant. So we can just redundant so we can just get rid of it And that Makes it a little easier to type we don't have to type big double every single time And we're going to have to do the same thing for here. We need to replace all the big doubles I'm in all the doubles Same thing with our costs And get rid of all these math dots Okay, and that replaces everything. I think we're error-free now and we can also change that Uh, okay. So now in here we do need to Uh, take in break infinity namespace the reason why it's because we need to Uh, set or notate to big double instead. So then now we will do that Okay And yeah right here Okay, so let's do our scientific notation real quick. So, uh, We have our var exponents and that is going to be equal to Uh, floor also i'm going to add in static break infinity Dot big double as well Okay, so now I can just do floor Uh, I think it's log base 10 Uh, absolute Num, okay now this I've explained how to do this in my scientific notation video. So if you haven't checked that out, I also have a Actually, I think I've yeah, I've explained in a few of my videos But check make sure you check that out if you don't understand So we have our exponent here And our mantisa Which is the decimal in front of the exponent To the left is simply Uh, pow Okay as num Divided by Num divided by 10 to the power of exponent. Okay There we go And now we need to join it all together. Okay So if all right now, we're just going to do a question mark operator. So Um, num greater than 1,000 now greater than or equal than 1,000 Also, I think I'm going to change this floor to because issues I've had in the past is uh, The 10.00 e Whatever, you know, it doesn't just shift up to the next one. It just stays like this Okay, so I need to fix that and I believe that happens because it in behind the scenes. It's really 9 0.995 I think I really don't know why that happens So I think I'm just gonna have to truncate it Let's try that. Let's try truncate. Okay Yeah, that seems Makes more sense. Okay. So if num is greater than or equal than 1000 Then we're going to Uh Make a string right here with the dollar sign. That's something we zoom in Um, okay, let's combine the mantisa And the exponent, okay And now what I'm gonna do with the exponent here is I'm gonna do n Uh here I'm gonna yeah, I'm gonna do n zero. Okay We don't need decimals for our exponent However, this n zero it's going to format as a comma. So if we get really large numbers We can see it as 1 e 3000 like that. Okay, or E 3 3.4 million like that. Okay, so it really really cool way of formatting it for us and for mantisa We just need to see two decimals and obviously I can add a setting Um, I can just do int decimal No, it's a variable. I can just put decimal right here and what I can do is add um I can add a string here dollar sign f deck. Okay I don't this will work Hmm interesting. I don't think this will work You can type two string Okay. Yeah, I guess that's the only way around it. So basically here, we're just gonna type in our decimal for how many Decimals we want to we'll merge it with f two or or the f So if we have two it's gonna show two decimals and by default we have two So we're just gonna set this equal to two So we don't have to put anything and if we want to change it, we can just type in a number So this is called a default parameter So if we said it equal to two and if we don't put anything in there Then it'll be set to two by default. So that's sort of the really cool thing about that So we don't have to type two for every single one when we can just Really put equals two because there will be cases where we want to see more decimals than usual Okay, and we're gonna want to do the same thing with here. So this is going to be num Um Yeah, this is just num two string And we're gonna do the exact same thing here except we're gonna replace f with n so we can get a comma And actually what i'm gonna do actually that's fine. I was gonna make it so that it starts showing up at a million, but Let's do that One two three one, okay, so now it's gonna start showing up at 10 million Okay, and I want to show you what it does with the commas because I think it's cool Okay, so now we need to add it to everything And unfortunately Uh, oh I want to try something I want to try Let's just go to our big double right here. I want to see if I can Use extendable in here and add it to the two string because I think that'll be really useful So let's try using extendables in here And let's find our two string and override it Right here Okay format dot big double Uh, is this a string? Yeah, let's try dot notate. Will this work? No, this is a string. Okay. I'm trying this this dot notate. Well, this work. I don't know Um, because I I don't I don't I want to see if I can try without adding it to every single thing If so, that would be freaking awesome because I just want to like Only apply the scientific notator this notation two big doubles So who knows if this will work if it does then oh my gosh, it's a lifesaver. We'll try Oh, what's wrong here? N it doesn't look our N Okay, so it's trying to do the two string here Oh Okay, so it looks like Format Okay, I have an idea. We're gonna comment all this out. I don't know what the format provider does However, I think I'm just gonna replace it with String format Let's take this as an int Uh, well, we can't cast this We just have to get rid of the Where's this N coming from though? I think I'm just gonna Have to do do it like this. I'm gonna try this. Okay now this probably won't work If it doesn't then I think I'm just gonna have to go with my original plan It's taking a long time to import now I doubt it'll work Oh Yeah, what is this? Oh, unity is like completely frozen. Oh, that's not good. Unity is like frozen Okay, I somehow got out of it. I don't know how but I did. All right nevermind. It's great We're going back to our original plan was So I'm not gonna I'm not gonna mess with anything here. So this now we have to Uh, do dot donate dot notate, which is okay. It's fine Also, I need to calculate this anti-matter per second Okay, so I'm gonna eventually do that in here. I'm just gonna ignore that for now Okay, so let me replace everything. We're not replaced but add on to here. I need a Using extendable real quick Okay, now I'm gonna add Notate all right so, uh Okay, so see this is one and one right so I'm just gonna put in one for here Okay, so the decimal is one Okay, so here now remember you have to add parentheses around all the variables. You can't just add dot Notate to the very end of it because of all the multiplication that's happening inside here So it makes you wrap that around with parentheses and then add the notate at the end And I think that's it. Okay So now we will get into the habit of using notate And I think we're good. So let's try it out Is unity still frozen seriously? I thought I forced quit Wait, what that doesn't make any sense. No unity is not frozen Goof We're still getting this error Go away. Okay. Um Unknown string format n so it doesn't oh man, they don't have n Oh That sucks Okay, so let's see. What's this format exponential Interesting format digits. Okay, so it looks like it doesn't even have it yet. So I'm gonna add on to it I'm gonna add an n. Okay, so let's see. What does this do? I oh man. Oh man. I don't want to do this. I don't want to do this too fixed Ah, this sucks Um You know what I'm not gonna bother. That's just no I don't really feel like doing that No, maybe another day All right, screw it. Well, we got to go back to f That stinks. I really wanted to use n Okay, well now we should be good to go and also that means we could probably use that Two string thing that we were using I don't know whatever Okay, so which means I'm gonna oh we're still getting this error. Why? Where are we getting this n? Oh right here. Okay, this should be f zero Um, okay, and also I'm gonna make this at 1000 now Okay, because I was I I don't know. I thought it would look cool with the commas for a little bit, but I guess not You need or yeah, I don't know Uh, okay, this looks fine Cool, we have our scientific notation. Everything looks correct. We also need to do that percent thing So I'll get there eventually All right and the per second Okay, well, we've already tested this phase. So I think we should just start moving on to the per second So we need to start converting everything into arrays because this is not acceptable here All right, so now we're gonna go to our data class And we're gonna create a big double array. We already know the size of it. So We're just gonna oh needs be an array Dimensions And then I'm just gonna call it lowercase dimensions and this is gonna be a new big double size a Okay, I'm gonna get rid of this. We're gonna get quite some errors And let's do the same thing for the rest. So we have our dim boost And our dimension levels so okay I'm gonna replace this with uh dimensions count and dimension counts and dimension levels, okay And we can honestly just get rid of all this and in our data class. We're gonna Make sure they start off with fresh new arrays like this All right And now in our dimensions, we're gonna see a bunch of errors. So that's okay Because we're gonna transform this into a for loop. So we're still using four dimensions right now So but I at least want to get this for loop started. So we're gonna start with var i equals one Okay, and the reason why we're doing one actually, let's see. What's this? um We can start at two Because of this right here, and I should have made this an array Okay, so this is first dimension. So we need to start at zero. Okay, and i is Uh less than let's see we're gonna do our first dimension is zero one two So we're stopping at three We're at two and All right, let's take this Now we just replace this with dimensions Dimension count at index i. Okay. So now dimension production is two more than i so we're gonna do i plus two Okay, and that should be good to go. We can delete these ones And we'll build this we'll keep adding on as we have more Production And also we will stop this at eight because we don't produce any eight. So it'll stop at six All right. So now let's do our dimension. So i'm gonna add a string up here public string array and this is going to be the dimension names, I guess It's gonna be a new string. It's going to be a size eight And actually we can just pre-define this in the start method So we only need to do it once and I don't think we have a start method. So let's create one private void start Okay, and now dimension Names is equal to a new array And we're just going to put first second I'm just going to copy and paste this So again third fourth fifth sixth seventh eighth, okay, so third fourth fifth Okay, so we have our dimension names and now we will access this all in a for loop And this should be all in the same for loop now. This is not going to be the same one as this one Just because we're going to be accessing more We're not we're going to be accessing all eight rather. This one's going to be accessing accessing The first seven, okay, and so we do this by doing var i equals zero i is less than eight And i plus plus okay, and in here we're just going to grab everything And put it in this for loop All right, so we're kind of in a messy situation here But we want to replace this dimensions as i and actually since we only have four dimensions let's just keep this at four, okay And we're going to replace this first with uh dimension names At index i All right, and uh this dimension this dim boost right here is uh just dim boost right here Actually, I think I'm just going to replace the name with dimension boost just to keep it consistent dimension Actually, I could just call it dim levels and dim counts now doesn't have to be short and dim boost at At index i Okay, cool. So now we can delete all of these And now the info text Instead of first dimensions, it's just going to be dimension count At index i Okay, and dimension levels That is going to be dimension levels and in index i Perfect now we can delete this And for the cost this is simply oh you need to replace the index here Now we just this is simply just i plus one, okay Alrighty Let's see. What else we have until 10 cost, okay, so this is also i plus one uh minus 10 all minus Uh i plus one And dimension levels Let's replace that and you can delete the rest, okay And now two more Okay, this should be pretty easy. Oh my what was that? Just got to replace this with i plus one And delete the rest i plus one Honestly, I should make a variable for this right here Should we do it? I think we should Let's see where does this end right here? Yeah, let's make uh, let's make a method variable. So this is public big double dimension Until 10 cost, okay, and this will require a parameter Or an integer parameter And this is simply going to return all of this. That's pretty easy Let's add that var. No, we only need data one. So I'm just gonna add the What is it game dot? Yeah game dot data, or is it main? Nope, that's fine Okay, and now i d is i instead And just like that and also we can make this into an Expression body with the arrow Cool. So now we can use this dimension until 10 cost and we'll replace all of this And Now it's not an array. So we got to add the parentheses i Okay, we'll do the same thing here Get rid of all this mess And that completely shortened it. So we shortened it a lot now remember that huge block of code It's now just a simple array And actually Eventually once we start adding more tabs, I will have that this user interface Only be updating when we're looking at it. Okay For the cost is only when we're buying it. Okay, so we'll do some optimization videos and stuff like that because This game can get very very heavy, especially if we're doing this in unity um Otherwise, I think we're good for arrays. Let's start with dimension shift. Oh, no this production thing Uh, okay, I see what's wrong here. So we need to access dimension count at index i minus zero. No, it's id minus one Okay, because we start at one now. I should have been consistent, but it's okay. I'll just do id minus one And Do the same thing for the rest Okay, so now I'm going to get rid of this switch statement because we really don't need this Okay, so we get rid of that And there we go much shorter And we can even probably get rid of this method now so we can just Do I want to I mean I already have it. Let's see. What are our levels? I think I can just Do this count. Where's our count dims's count, right? Yeah Yeah, we'll just get rid of this. I think that's kind of pointless Okay, so now I'm going to get rid of that Perfect also level. What's the yeah, this is level cool Now it looks a little messy, but it's actually pretty short and simple and it's because this inverted If statement is not very friendly with us And yeah, but it just it doesn't look very neat, but it's a I don't know I like it Let's we can invert it if we want to so it looks like this Uh, let's just keep it. I just hate seeing these dumb blue lines so, okay Okay, we need to do our anti-matter per second and this is basically just going to sum up the production of One that's pretty much it. So we actually probably don't even need this right here Okay, so we see to access this in here So now we can finally replace this with Let's see. We need to get our dimensions in here. So let's Let's add our dimensions class Okay, and now we'll just do dimensions dot dimension production One and don't forget the the notate Okay, and now we should be good I need to do save system fast probably after this After galaxy at least because that's going to take forever to test. Oh, we have some errors. What's going on? Oh the dimension cost Whoo, so now I'm actually going to create some more arrays here while we're at it. Okay So what we can do here is create A public big double array and this will be called Dimension base costs, okay And we will pre define this in the start method and we'll do the same thing for the cost molt. So Which is this right here? And this will be cost molt. We can honestly make these doubles, but I really don't want to be inconsistent yet Because we can change these types whenever we want to Okay, and this will also be able to replace our switch statement or switch case And okay, so let's just simply take this and return base cost at index id And times the no, this is the yeah, that's right times the cost molt to the power of Dim boost, which is data dot dimension boost at id What's wrong here? Oh, I see We don't need that here Cool. So now we can get rid of our switch case and get rid of this other return. There we go. It's pretty simple Okay, also we can get rid of this temporary Variable because we only use data once which means we can turn this to an expression body Okay, so we have two really short pieces of code right here Our methods just one line or a set's awesome. I love that you can do this And I think production is good as is we will add on to this We need to oh shoot. I deleted our base costs Okay, hold on We're gonna do this. We're just gonna copy this and there we go Okay, so now in our start method we need to Let's see our base costs. We're gonna create a new big double Uh, we can yeah, just a new big double array Okay And let's see what's pastes below. We're gonna have a bunch of red lines here But ignore it for now and we will just start with 10 124 16. Okay, and we will add on to this once we finish the other dimensions And we also want to do our dimension cost mult Okay, and that is 1 e 3 1 e 4 1 e 5 1 e 6 Okay, and delete this and we should be set Okay, no more errors. No more Okay, so we're getting errors here index was out of the bounds of the array I don't know why I believe it's because of dimension cost. It's the way we're accessing it. I don't know Where are we accessing this? Let's see. It's one of our arrays maybe Oh, no reference. Okay, maybe that's why Okay So we need to get our dimensions manager in here. Hopefully this will work Okay, that fixed one of our issues. We're still getting a Out of bounds here Oh, I see here. It's something to do with our dimension cost Okay Well, the reason why this isn't an issue now is because of we were doing that plus one right because of our switch case was based on or One uh index one it based index instead of zero. So now what we can do here for our cost We can get rid of this plus one. Okay Since we are accessing directly to the array we can just do uh i All right, and this should fix our issue Also, don't forget to save often. It's pretty important. Okay I've lost hours. I've lost days of progress because of me being an idiot Also, github is very helpful too Oh Another one of these. Okay. Let's see. Where is the origin of this? It's the until 10 cost. Okay So You see, okay. I forgot we have one more plus one here same here Okay So make sure you pay attention to these errors. So if you immediately sit index out of range It's like, oh, it's an array error. Okay, and if you just change something like this Then you should know that you got to fix the plus ones like I did. It's problem solving Okay I cannot buy now. What's wrong here? What's wrong here? Okay, so our game isn't frozen. That's good Uh, why can I not buy anything? I don't know. Oh buy dimension. What's this? Why is it grayed out? Is this button like completely gone? Oh I see here. Okay Now remember our dimension cost is based on id so we start at zero, right? So basically this is trying to buy a second dimension. So don't forget to shift all the buttons to to zero one Two and three Okay, and save it and let's play and we should be able to buy their first dimension now Perfect. Oh, man. Another one of these are uh What is wrong? Okay, so our demand. Okay. So you see we do the minus one thing here We gotta I need to pay closer attention, but it's okay. We all make these elementary mistakes Okay, so just make sure you pay attention to how you're accessing the arrays. Okay Very important. You cannot be out of bounds Or else you'll get these kind of annoying errors Okay, finally and we got our anti-matter per second going Also, I'll do tick speed after dimension shifts. Okay, I'll probably be third episode I don't know. These are fun. I just want to keep pumping these videos out But I want to be consistent at the same time and it's they're pretty long. So Uh, I still need to make the the buy until 10 So I'm a little I'm running a little behind. I should have done a little more previous video, but it's okay Yeah, let's see if we yeah, I won't buy anything Okay, let's buy this one right here. Let it start producing Perfect Also We have two decimals here, right and anti-matter dimensions. We only have zero. So let's fix that real quick and that is located Uh, where is that right here? No, it's the info text. Okay So let's put this is zero in our notate method and it should fix that Now you can change this to whatever you want. I'm just going to do zero Just to keep it consistent also and I think anti-matter is a whole number as well Okay, I had to load an incognito For a new save. Yep. Oh, it's one decimal Interesting. Okay. Well, let's make sure that happens. Also. We got a lot of progress from doing nothing Cool. So I'm gonna oh man I'm gonna go to my game controller here and set notate to one I think our per second is exactly the same here. Oh, I closed it I'm just gonna trust that it's a one decimal Okay, and I should make this. Oh, yeah, it already is one No Oh, yeah, there we go Okay, and we can also we should make it so we can change it in the settings too. Okay. So let's keep buying these So now we should make in two per second Cool. I like how this turns out beautiful Uh, okay, I think we should start dimension shift, which means I loaded the game at the perfect rate Okay, so by default, uh, do we still have our note document open? No, we don't. Okay. Let me open that real quick Okay, so our base cost is 20, right? We know, okay, so I remember obviously it's 20 until we get to five, right? So let's just buy another one Yeah, so it's fifth dimension. Okay. So you see we see the pattern here. So we need to start Getting these other dimensions here, right? So let's start Uh, let's start creating these costs and I believe actually let's keep playing right now I'm going to skip forward to the fifth dimension Also, if we haven't noticed yet dimension shift, uh multiplies the first one By two, right? So we'll see what happens if we get the, um The other one. Okay. So let's add it to our notes. Okay. So we have unlocked the fifth dimension So our base cost is 1.9 and I and I predict our Cost molt is 1.7 And our base production is the same Plus 0.1 per second And our next cost is going to be I said 1.7, right? Yeah, so that's 1.8 16 Okay, so I will continue this Okay, so we're gonna buy one and let's see is our production That's kind of hard to tell because we have tick speeds. It should be every five seconds. So one No, it's we gotta start zero one two three four five. Yeah about that Okay, and So we know the production is correct our cost. Okay, so I'm gonna speed it up All right. I'm gonna speed it up Okay, so our now our production is Roughly four per second. Okay Just a tad bit above that Okay, so now I'm gonna speed up. So now I don't have all day right now and I've Uh, I gotta eat dinner soon. So I'm gonna kind of Cheat in I hate to do this. I hate that. I don't I don't want people to do this But just for the sake of moving on with the video. I'm just going to oh, yeah, our cost will it or yeah, our cost is Uh, 2017. Okay, so it looks like Hmm Okay, so I guess the cost molt is one e Yeah, so it's Okay, so we're starting to get some different scaling here. So it looks like maybe the next one will be one e 11 I'm guessing it'll be either one e 10 or one e 11. That's my guess Okay, so I'm gonna buy this and see That happens 20 25 Right, where is it right here? Is that eight? Yeah, that is okay So we have a constant colt colt Multi 28 and I'm sorry. I'm gonna uh buy another dimension shift. Okay, so we'll see what happens with this So now we have a four times here Okay, and we unlock this We unlock the next one. Okay, so this will be cost five cost six Okay, so this unlocks dim six And now the first dim is four and now the second dimension. I believe is two. Yeah Okay, so we're gonna have to kind of figure this out We're about to make an equation for this Okay, let's get on with the dimension shift Okay, I'm gonna make these privates because we don't don't think we need to access these anywhere else for now Uh, okay, so dimension shift Hooray Here comes one of the first struggles. I'm probably gonna deal with also. I think I wrote down something I forgot to do maybe not. No, I'm just gonna ignore it. Okay Uh, also ignore these. This is really dumb right here because That's just dumb right here because if we're gonna add a new array, it's gonna be an empty array We're not creating a new One every time, right? Okay, so just leave these here ignore this stupid yellow line Because this is not like I don't know unity protected where if you compile On a normal basis, it will create this Array based on what's in the constructor while in unity it doesn't it only does that once Which is on the first time you load it Or create the variable, okay But once we start with the save system, it kind of just doesn't work that way Okay, so We're gonna calculate we're gonna. Uh, so instead of levels here, we're gonna create, uh shifts, okay Dimension shifts Now We need to also have a separate variable for how many shifts we have so we're just gonna put shift boost, okay And then down here, I think we're just gonna make a big double here Public big double Dimension shifts, okay And also this will be a type of big double and we can just copy and paste this down here replace the u-short with the big double Okay, and dimension shifts down here will be set equal to zero Okay, so we need to somehow calculate what this is And this will be a little weird because again, we're we're working in a ladder Okay, so let's go to our dimensions here and I'm just going to create a temporary Uh, I'm just going to create How am I doing this Okay, I think I'm just going to create a big double Dimension shift boost in here a method a big double method and I'm going to calculate it in here, okay And basically this boost is Based on the current one. So we need so we're gonna need to make a ladder here. Okay So obviously by default it's going to be big double dot pow Game dot data Game dot data dot dimension shifts, right? I know dimension shifts. Yeah Right, so by default it's like this However, we need to subtract this by one every time we have an id right here. Okay Uh, also this is two to the power of the shifts and now we're going to subtract this by id Okay, so The first dimension is zero, right? So we're not subtracting anything Okay, so once we have our first dimension shift Uh, two to the power of one is two. Okay, so only our first dimension is going to get that boost Now for our second dimension, we're subtracting one because our id is one Okay, so we want to make sure this boost does not go negative. Okay, and how do we do that? Well, we check if this is greater than Well, we're not going to do anything here. Okay, so Actually, why am I doing this like why am I doing it like this? I think I should just do do it like this. Yeah Uh, let's remove this id we're just going to do this in a for loop Okay, so we're going to take this We're going to make a for loop for var i equals zero and so we really want to mess with the first We're going to want to mess with the first five dimensions now and eventually eight Let's actually start with four Okay And in here for our for loop, we are going to put let's have a var data equals game dot data Okay, so data dot Dimension shift boost is going to be equal to power power or two to the power of dimension shifts Minus i okay And we don't want to access this in our array. So we do add index i Okay, so now we want to check to make sure if this is greater than zero or not. Okay So i'm going to make a variable inside this for loop Okay, so now we only need to calculate this once so we can just do if this temp boost is less than one Okay, less than one Then we're going to use one instead. Okay, so the boost is one by default Otherwise, it's temp boost. Okay, so now we need to be able to use this right here So, uh Where what's going on here? Okay, um Okay, so we have our dimension boost here So we need to multiply this so dimension times that we also need to Multiply this power right here Okay, so we're kind of getting to the point where we need to start accessing things and methods So let's create another method Called private big double dimension boost Okay, and id And actually this can probably be accessed in a expression body And we we're going to take this right here Move it up here multiply Okay, we just need to multiply this right here But with our with our shift boost. Okay, so we're just going to do game dots data Or like that and replace the i with id Okay, so now we can use dimension boost down here like that And put i as our parameter Okay, so let's see where else do we use this boost because uh, we use it in other places We use it up here wherever we add to our Production right? Yeah our dimension production method. Okay Um, okay, so now we're going to replace this boost with This right here and now instead of id we're going to do id minus one Okay, and now we're just going to replace all of these cool And we can honestly just like get rid of these Okay, so what we're going to do is get rid of the switch case. So We can just do if uh, yeah, we can do this in a question mark operator. Okay, so If id is equal to one then we're going to return this first statement up here Otherwise, we are going to return this one right here. Okay And we do that by the colon and like that Okay, we can get rid of the rest of this and make sure this is right. Yep Whew and we can make this a question mark operator. I'd rather have a question mark operator than and just type game a few times rather than Wasting a few lines of code just like that Cool see all these expression bodies that is just so helpful and it looks pretty in me or in my opinion. Okay So now we have our dimension boost when we shift. So we need to actually shift. Okay, so under our by dimension We're going to do a public void Um Dimension shift we're just actually I'm just going to call this by dimension shift even though we're not really by I mean We are buying I guess by dimension shifts. Okay, so making the cost is probably going to be one of the harder things to do um Okay so We need to have a cost Okay So we're going to have a public big double dimension Dimension shift Cost okay, and basically this is just going to equal To you know, let's not do this an expression body yet Okay, so return Let's see game dot data. No, what's this? Game dot data What is wrong? What is it doing? Oh, I see now Okay game dot data dot dimension shifts Okay So let's see we have our first one is six Seven eight and then we start scaling after we buy the first three. Okay, so once we buy one we get six Seven eight, so I think if dimension shifts is greater than three Then we're going to start our cost thing. Otherwise it's going to be um, so I don't know what it is right now So I'm just going to keep it as 20 And now let's see this is going to say oh, you can just remove this right But we want to find out what this actually is scaling to because we can just calculate it And we can make this into an expression body Okay, so now we can use this in here. So if we need to somehow calculate, uh, which dimension shift we have And I think the only way I can possibly think of this Is using a switch statement. Okay, so in here, we're going to create a of our data equals game dot data variable and We're going to use a switch data dot dimension shifts Okay And basically if we have no dimension shifts, that's case zero Also, the problem here is that um Yeah Pretty much this can only be used. Uh, it doesn't support big double. So here we're just going to cast this as an int Okay And already Let's see here I'm only going to do this for if Yeah, okay. I'm just going to do this if Dimension shifts is less than Are you equal than three? Okay, then we're going to use the switch statements right here. Otherwise, we will do all the calculations below Alrighty, so now if And Okay Can we get rid of this right here? We can okay, so if dimension shifts, no, no, no If data dot dimension count At index, so let's see three is our fourth dimension So if dimension count three is greater than or equal than uh, dimension shift cost Then we're going to reset all this. Okay And in here, I'm just going to make a method called avoid reset shift Okay, or it's actually just going to call the shift reset because we only want to reset certain things in here And we will use this right here In our in the future when we get galaxies Okay, so basically we're going to create a uh, basically just going to go to our data and Reset all this. Okay Okay, and oh, we don't want to reset. We want we only want to reset. Uh, Let's see I don't think we want to reset shift boost. Yeah, we don't want to So basically to reset these we're just going to create a brand new array Which basically wipes everything sets them back to zero and we also want to set our antimatter back to 10 Okay Cool. So now we will do a shift reset perfect Also, we need to add a break try anything. Is there anything else? Oh, yeah, we need to add to our uh, dimension shifts, right And we can actually add this to No, I don't want to do that We'll do it here. Okay, and we're going to do the same thing for This is not fun Also, I don't think we need this id here I don't know why I added that so let's just we can shorten this later on but let's start with the first Three or first four Okay, so dimension four dimension five six seven and we also need eight Right Yeah Okay, so that means this dimension shifts has to be greater than four And this has to be less than or equal than four Again, we can really shorten this we can even probably just uh See I want to be okay. I want to be able to use this in the future. So let's just move this out here Let's call this a public void shift reset Our data equals game dot data. Okay. And now in here I want to do And this is just going to be called a recent just yeah, this we're just going to shift in here. I don't know And I'm basically just going to grab this here Okay We need to calculate this in so we're going to do into id and put this id in here. Okay. Cool. Now we can shorten this a lot And eventually probably much more Okay, so now we only need to do this Can we break in here and then get rid of this? I don't know that doesn't work. Yeah, I figured Six five four three Three four five six, okay And honestly we can make this cost start the scale out We'll adjust all this once we start getting Used to this layout and honestly, I don't want to start with the dimension shift afterwards Okay So let's see where we at. I think we should start I think we should start expanding our Our dimensions to eight because we're going to need it And it'll really suck Yeah Um, okay. So another thing we need to do. Yes. This is a lot of work and this is a freaking long video But there's a there's so much to do in this game It's crazy. It may seem so simple, but there's actually a lot We need to determine if the if our dimension is unlocked or not. So we're going to create a bool array dimension unlocked Okay And this will be a new bool size eight And we're going to add this to our constructor Okay dimension unlocked Dimensions unlocked. Okay. So now in our dimensions here, we need to Do uh, we need to add this right here So and if Well, I mean we can just hide the we can just hide the dimension anyway. So let's do that. Okay. So we're going to add a Yet another array we're going to add a game object array this time And this is going to be the dimension game objects Okay, and this will be a new game object array. That's a size eight Okay, and let's see if we can handle this uh We only need it for like I'm just going to add it because we know by default the first four our our um Are unlocked, right? So we're just going to set this unlocked array data dot The game about data dot Unlocked is equal to new array Hmm This is really weird Because I'm trying to think do we ever have a point in time where we never see the first before dimensions? I don't think so. So this is just going to be a size four bool instead Because we only need to unlock five through eight. Well, we do We do have to eventually hide them. Yeah So we do need eight. Okay, cool that that works out, but still um So they're all false right now, right? So we're going to update this in here Okay, so we're going to do dimension game objects at index i dot game object dot set active And we're going to make this equal to data dot dimensions unlocked at index i Simple as that, right? So now We need to do this we need to manage this in here Okay, so not now by default obviously we need to make sure um Okay, so we're going to set uh if dimensions Okay, so if Dimensions at index zero is false then we're going to set it to true because it's always going to be true, right? That's just one of those things that's always true okay so Now we can grab this right here and go back to our by dimension I'm really sorry if I'm all over the place. This is actually just this is just really crazy and fascinating and I'm just like Oh my gosh, what do I do? It's also a little confusing Um, okay, so now if the dimension is unlocked Okay, and then we will buy it cool Uh, this is that id and now we need to set the next one to true I think it's unlocked After we buy 10 I believe so let's see. Nope. It's after we buy the first one. Okay, so now we're gonna do if uh dimensions unlocked id plus one and And id is Not equal to or we'll just say less than eight because we don't want to do this for the eighth dimension because there is no ninth dimension Or maybe heavy spill the beans Okay, so in here we want to be able to set this to true Okay, cool. So now we will do this unlock system and I think that'll look pretty cool And we are eventually gonna finish this up This is a big game We only have so little though Okay, let's see. Let's see. Let's see. Oh, we also need to reset these unlocks. So we're gonna set a Data.dimensions unlocked to a new bull size eight perfect Okay, now we need to finish these cost molds so I only have eight But I feel like I should just keep going. I think I'm just gonna cheat this in I hate cheating But I need to know all these costs Okay, so let's just keep going Okay, we're getting a bunch of this done. So we have five Okay, so we have one e-13 Okay So I'm gonna keep adding this So the base is one e-13 10 Okay, I had a feeling it was e 10. It was either 11 or 10 Okay, cool Let's keep buying this One two, oh shoot one two three Four Five six one e-18 And I know the production is the same. Okay, I know that for a fact by now So we have one e-18 One e-30. Okay. So what is this? This is uh 12 Yeah, okay, and I believe the next one's gonna be e of 14 if not e 16 or 15 Okay Okay, so we have 24 24 and the cost oh it's 20 39. So it's 15. Okay We have all of our costs Perfecto. We can now move on Okay, so let's see we have e 3 e 4 e 5 e 6 And then e 8 Can I type e 8 does that work? No 28 20 10 1 e 12 1 e 15. Is that correct? Yes, it is. Okay, and now for our base costs. We have e 6 e 9 29 1 e 13 and 13 18 29 or 24 18 20 24 cool um We just need to make sure we don't have any fours around here This dimension count we need to increase this to six Because we don't add on to the eighth. All right Not till later on Far later on Okay, because there is no ninth dimension again heavy. I know you're hiding that secret from us There's there's definitely ninth dimensions Mm-hmm. Um, okay I think this is all good Awesome. Awesome. Awesome So let's okay. This is let's see this is dimension shift. Look like it's gonna work. I don't know We will test that theory. Also. Let's see. What's oh, yes. I could still buy these. I'm not supposed to Also, I need to buy this. I need to do the buy until 10. So let's do that So let's do buy dimension Uh Buy until 10. Okay. Now it's the same thing Except we need to grab the dimension cost until 10 Right here Okay, same thing here dimension levels. Uh, so dimension levels is equal to zero So we just ignore this here. We add We add the count to However many levels we have now Okay So however many is we have now. So let's say we have five or let's say we have four We are buying six more. So we do 10 minus the current amount of levels we have now okay and Yeah, we have this unlocked thing here Yeah, I think that's it Oh, we also need to increase the boost like that Perfect. So that was pretty easy Pretty easy We also need to finish the rest of these dimensions here Okay, and then I think we are done. Oh, we needed the UI for the dimension shift Okay, so I'm going to assign the buttons now. So it's buy until 10 Uh Okay, so that's zero one two three Okay, and now in our dimensions manager, we want to drag all of our Um, our game objects, but we don't have them all yet. So let's finish that up first So we have dimension four five six seven eight dimension five dimension six Kind of run out of ui now We got barely a little space for the dimension shifts down here. I mean it doesn't take that much space Just like two more lines, which I think they'll fit perfectly Barely perfectly But we're running out of space fast. Wow It's crazy The UI here is just so snug and I could probably like move things up too Alrighty Oh, we also need to do the buy max all which I'm gonna do later on Okay, so now we have all of our game objects. Let's just drag everything in here dimension one two three four Okay, so now we got to finish our buttons here And we got to change all these numbers again Okay, so now we have our dimension Our dimensions here. We need to do dimension shifts right here or dimension boost Dim what wait a minute. I thought this was called dimension shift Huh, I'm so confused now You know what I'm just gonna continue this as a dimension shift. I I swear. That's what it was called dimension shift. I'd You know what it's whatever So at least I know it's a dimension shift or what it actually is then I think we're okay So we have to have this same Thing except this is not a prefapse. I'm gonna unpack this completely. This is I'm just gonna call this the dimension shift whatever And this is gonna really be spaced out just a little bit more Yeah, see we're barely out of room down there Okay, that's okay. Let's see. What's this let's divide it by There we go. We'll okay. We'll share equal space with uh anti-matter galaxies Even though it looks a little bigger Okay, so this is called dimension boost Dimension boost We haven't done the cost text yet Okay, so now I'm gonna sign the dimension shift Right here by dimension shift to the Button right here. Also. I still have to do the colors. So I will do that as well Okay Okay, I'm really scared to try this but let's go ahead. I haven't done any of the text yet. So We will I'm expecting some errors Oh snap So now the thing is that it doesn't like uh, I'm gonna have to find a way I mean, it's obviously not that hard but to have it move down with it So I will eventually learn how to do that But I'm just gonna make it so it moves to the to the top of this right here, which shouldn't be too bad um, okay So let's buy one it's oh, it didn't even unlock the other one and it's not producing any per second So that's not good And this is a zero right here. So I guess the reason why this is happening is because for some reason This dimension boost right here this dimension shift is making this a zero So let's check out our dimensions manager. Let's see. Is it in here? I don't think it is. Oh dimension boost Okay So Yeah, this is zero But it should be plus one. So shift boost shift boost is also zero Why is this happening? Oh, I I remember why is because we didn't actually set the shifts Or did we? Oh, yeah, we didn't even run this method Well, that's uh, awesome Yeah, don't forget to run this okay And this buy method that's good Also, let's move that back Okay, let's add this text real quick So this will be up here So this is a public text Uh dimension I know this is a tm pro right? Yeah tmp text dimension Shift text, okay Okay, so dimension boost uh data dot dimension shift Uh dimension shifts. Yeah And then this will be requires the cost. Okay, so Requires The cost right here and we need to have the name here dimensions. Okay, so this is tricky the dimensions part right here So I think what we're going to do here Is Do the same thing with the dimension shifts here So let's see where's our names right here dimension names. So we have dimension names at index Uh, so we have zero shifts, right? So we want to start at zero one two three, right? So this is dimension shifts plus three Okay, so now the problem here is that the index is um, it's big right? So what I'm going to do here is use a I'm going to use a question mark operator. Okay So if uh, yeah So if dimension shifts is less than eight Yeah, no if it's greater than or equal than eight No, it's just greater than eight Right? Yeah, greater than seven. Okay, greater than seven Then we are going to set this to seven. Otherwise we are going to cast dimension shifts as an int And add by three Also, this actually no, this should be four dimension shifts should be four Okay, because of the plus three here I'm gonna I guess we can get rid of these parentheses here And now so we have this and now we need to access the cost here, which is pretty easy We have the variables and done like that's cool. Hopefully we'll cross our fingers. It should work Okay, so don't forget to drag your your dimension shift text right here And let's see what this looks like And this should say one times. Yep, perfect Uh, this is dimension four dimension dimensions. Okay. Well, that didn't really work out as planned in it Well, so let's see it says requires 20 dimension So where is this dimension coming from? So we have the cost We also have dimensions dimension. What the heck is this? Dimensions for dimension dimensions. What happened here? Wow This like we're really screwed up. Okay Um, so it's clearly something with this right here. I don't know what went wrong Oh, it's just dimensions. Oh, we forgot to do dimension names. Okay. Let's just quickly restart this Since importing doesn't take that long and I'm really curious to see if this will work Also, I'm really sorry if this is an extremely watch extremely long video if you're still watching. Thank you very much Yay. Okay. So now if we reset it shouldn't do anything Yep, perfect It still didn't unlock though. That's not good So if we go to our scripts or bull or unlocked right here, so it says the first one's unlocked, right? So I think the issue here is that when we're buying it's not Unlocking the right one So let's see it should be unlocking the next one, right? So we need to do id plus one for the dimensions unlocked bull array All right, so let this load and then I will play this Now when we buy this we should unlock the next one Oh, man It still doesn't want us to buy this one Okay I see. Okay, so the so now we're checking to see if this is true So we want to make sure that it's false. So if it's false, then we need to make it true. We need to unlock it Okay Now we can't just set it to true every time But that's kind of a just a redundant call especially when it's already true when we can just only do it if it's false The smallest bit of optimization. Okay, so now it works. Perfect And let's try this by until 10. So we'll do that 20 Let's speed this up a bit No, and I can't drag it dang Okay, it's all it's all right it's speeding up. Okay, so now let's get to 20 and if we buy this it should work Ah, it doesn't reset the cot. It doesn't reset this though. That's the thing Um, okay, that's okay Let's see. How do we fix this? So by until 10 we need to set level back to zero So let's grab this right here. We need to reset level back to zero. That's the only thing we need to do here Um, okay, so let's try to get to this fourth dimension here I'm gonna speed this up See, I know our our anti-matter is very off, but it's okay. I'm just wanting to test this Oh, we have fifth dimensions. That's not good. We don't want to see fifth dimension so now we were able to buy this because Now I didn't add that if statement in the buy because this should not appear at all So we're just going to completely ignore this fifth dimension for now And now we should be able to reset this once we have 20. Okay, good. It doesn't reset early So we're going to set this to 13 Let's buy these and now we should be able to dimension shift So this should be set to two times and everything should be back to normal Awesome It works. Yes We got this dimension shift to work Awesome This makes me so happy. This is so much fun So now let's try getting another dimension shift right here. Okay, so I'm gonna speed or I'm not gonna speed this up I'm just gonna buy all these Uh, okay, so let's just buy up to the 20th dimension Which we can Yeah, we can just buy this. Okay, so let's buy to the Okay, so let's buy it to the 25th dimension and then this should be four times. This should be two times. So let's try that out Okay, so that's four times. Awesome. That is two times and the next one should be one times Okay, this is speeding up. Oh, yes, it works. Yes So it feels so good That is the best feeling ever One of the best feelings is when you just get something and you're just like cool. So we just need to fix this thing with the dimensions unlocked, right? Uh, let's see. How do we do this? So I'm gonna add an if statement Uh, and Um, so we need this is based on our dimension shift. So let's say We were trying to unlock five, right? So five we need our dimension shift to be one Or else we can't see at all so If id no if dimension shifts Is greater than Yeah, it's greater than or equal than id plus four plus four That's not right So if the dimension shift is greater than or equal to plus four No, no, it's not right Uh, it needs to be the opposite. So if it's less than So if dimension shifts, let's say if it's zero So if zero is less than Five Hmm So let's say we're buying the third the fourth one. So we have zero one two three So we have three We want to buy the next one. So if dimension shifts is uh, so right now it's at zero So we're trying to compare it to three Let's let's do this in a notepad Okay, so let's say uh dimension shift and Uh id so let's id Okay, so let's say dimension shift is zero, right? And we're trying to buy the the fourth one, right? So that's index Three so now the next one is four, right? I know this is a weird formatting thing. I don't I'm just typing whatever We don't want to see the fourth one because we want this to be greater than Uh one, right? So if this is one, then yeah, this will work This is no and this is a yes, okay So I think we just need to calculate if the next one Next one minus three if dimension shift is If dimension shift is greater than or equal then Our id Minus two Then I think that should work, right? Does that sound Correct? I don't know let's try it And we will have to try this for both dimension shifts and I will need yeah We can finally do the buy until 10 now too by the way So let's just test both of those things real quick And let's see does that work Perfect it works So now if you buy this we should not be able to see the fifth perfect awesome We're getting somewhere guys Okay, so let's Uh dimension shift so now we should only see up to the fifth. So let's go Also need to add keybinds too What's going on here? Oh, I need to add the same thing. I think Yeah, there we go that works just fine now Cool Well, let's see what's going on here. Why is this okay? Let's just add this to the Right here All right, I think that's the only thing we need to do here Yeah, okay, so now if we do dimension 10 it should work. So let's try that real quick So I've already done this And I think I should try until 10 or Eighth dimension and then I'm going to stop there Okay, because the cost is going to be constantly at 20 But I just want to make sure we don't get any uh errors. So let's try this So yep, if you buy 10 it works perfectly I need to add a keybind so badly Also, this is one decimal. That's not right Okay, so we have our seventh dimension awesome So let's do that and now we should Be able to skip right to this Oh, yep, we have a we have a an error Let's see. Where is this happening? Buy until 10 Yeah, see this is what I was saying So we need to do if less than seven Right Because there is yeah, that sounds right Okay So that should fix that issue and now if we keep going So now it says 25th dimensions. That's not correct Uh, let's just keep trying They should see eighth dimensions now So now we can't get through this I think that's just because we got a okay, so we have to have More fifth dimensions. Maybe I don't know that's interesting But I think for the most part this works. Let's see. I got a text Dinner start hitting the kitchen. Okay All right, I'll be back after this. I'm going to fix a few bugs So I thought I was recording the entire time when I came back, but I guess not So I'll kind of explain what my changes were So I was exploring the dimensional sacrifice, which I would do Probably in the next episode next episode or two Maybe next one. Um, but I was explaining how the Notation method is now it now looks like this here. I'll kind of Bring this to a new line So I actually forgot that big double has two variables Which is the mantisa and exponents and that gives us the ability to use n because mantisa is a double and exponent is a long So I decided to change it back to the n right here and um Yeah, we can't use it for this one because we do num right here And this is still a big double here. So we can't use n here I created this second Uh optional parameter for this one right here because I already have Methods with the number for the first decimal, which is this one right here So I added a second one because most likely we won't be able to change We won't need to change this one unless there's a setting for that and that will adjust how many decimals we see For the exponent system. So we got that I fixed some stuff in the by dimensions here Such as this line. I oh, I'm still trying this one here and this one here Hopefully I didn't miss anything. I created a um a button here For the for the for when you can start Or for when you can shift I created a temp variable with this Uh right here, which is what we used for the text originally. So For getting the dimension names And then uh, we set the color equal to if we can so basically if we can do a dimension shift Then we set it to green otherwise we set it to red and I think that's everything I did while I was gone Hopefully I didn't forget anything. Oh, yeah, I also finished the the scaling for the dimension shift shift cost Which is 20 plus Dimension shifts minus four times 15. Okay, so now I have explored that It adds every 15 for now I'm at one. I was at 110 at one at some point and it kept increasing by 15 So we're gonna stick with that unless we see something different Okay, so let's go back to unity And let's run this so the bug I was trying to solve was this Um, the eighth dimension not showing up or it was calling causing some out of bounds error, which was really interesting So let's keep going Also, see this is what the comma system looks like Looks really neat. It's way easier than I thought These buttons are a little small, but it's okay. I wish I had the bimax Okay, so now let's see is we have we have a 28th dimensions and hopefully it'll unlock properly Ah, man Still why? Okay, you know, it's fine So now if we buy here, it increases by 15. So now we have Dimension shifts for all of these Okay, so we have 34 or 32 16 8 And then the next one should be four and then two It works perfectly very happy with the results so far Yeah, so we have the two right here perfect. So it's like a ladder now And it's looking pretty nice Okay, so we need to fix. What is this error? Like I don't get it If we get rid of if we make it so we can't access this right here that we cannot add the 8th, right? It's really really weird So I think it's I think it's this right here this array right here Maybe So yeah, it's trying to access another one right here, right? So I think we need to add another if statements So what I can do here is move this id right here So basically it's going to check for Um, if it's going to check for this first, right? And if this is false, then all of all of this is false, right? It won't check for here. It won't check for here So then we won't get this they won't get this out of bounds error. Hopefully if we still do I in a future episode then I'm just going to have to add another if statement above this and hopefully that won't be the case All right. Anyways, if you enjoyed this video make sure you smash the like button subscribe to my channel if you're new heavy If you're here, hello, welcome to the video series. I hope you enjoyed it as well as much as I did Um, comment your feedback and everything and everything below check out the patreon and description If you want to support my channel and check out my other videos in the top right corner Anyway, see you guys in another video. Peace