All right so let's concentrate on getting our flaps buttons all hooked up.
So let's jump back into unity and get it going.
OK.
So let's get the flap buttons all hooked up.
So I've gone ahead and created some sprites for us to use.
All right.
So again you guys are more than welcome to come up with a better design.
I'm just trying to get everything hooked up and you know make it more mobile friendly.
So what I want to do is I'm going to go into the control panel here and just add a new button.
All right we'll call this the flaps up button.
All right.
And what I'm going to do is give it the flaps up buttons right.
Right Turn on the preserve aspect and set the native size.
All right and then again we don't need the text inside of that particular button.
So what I'm going to do is drag this over here and I'm going to scale down a little bit because I want
to try to fit that same radius that we got for the thumb stick right there.
So I just kind of want to match that up.
Looks like it needs to be a little bit.
It looks pretty good.
Maybe a little bit bigger here.
All right.
Something smaller actually.
There we go.
That is working out just great.
So we're a little bit of space there.
Like so.
Ok cool.
So what I want to do now is I want to give it a little color right.
I'm going to maybe do a little bit of green for these guys.
The saturated green though.
All right.
Perfect.
OK.
So what I'm going to do now is just duplicate that and call this the flaps down button.
So DWM are down.
And I'm going to move it all the way across and the reason why I am copying it is so that I get that
same height that we've got over here the same scale and everything all I need to do really is just drag
and drop the flaps down Spryte texture there and just line it up with the other domestic.
All right.
So with that we are almost done.
Actually we don't need to add any custom events for this so we don't need to utilize the event trigger.
All we really need to do is add one little tiny method to our script our mobile airplane input script
here.
So what I'm going to do is type out public void set flaps and I'm going to send an integer this time
because if you remember from the base airplane script over here we have our flaps is set to an integer.
All right.
So to make sure it's an integer value that we're passing in and I'm going to call it value just to keep
things nice and generic.
All right so with that what we're going to do is say flaps plus equals a value and that should get it's
all working.
So let's go back into unity now.
Let that compile OK.
And what we want to do is we want to add a listener to the on click event for both the flaps up and
the flaps down button.
All right.
So let's start with the flaps up here.
And what are we going to do is I am going to hit the plus sign right here to add a listener and we're
going to drag and drop in the typical airplane and then in the function drop down what we're going to
do is select the mobile airplane input script and then select that set flaps method that we just created.
And remember when we want to pull the flaps up we're going to send in a negative one value.
All right so then for the flaps down button we're going to send in a positive one.
All right.
So let's go and drag and drop the airplane and then select the mobile airplane and put scripts flaps
method right here and we'll set the value to one.
So that should actually get our flaps now working pretty easy.
So let's go and hit play just to test this out.
All right.
So let's do flaps down.
All right.
You can see that we can actually just keep going.
So we're not actually clamping the value here and we're getting some weird interaction.
There must be something with the collision lushes.
All right so what I want to do is I need to clamp it so take a look again back at our base airplane
and put scripts so you can see that we're actually clamping the flaps here and we have to do that for
every single input script.
Now that's not necessarily modular or as modular as I would like it because I don't want to have to
have the same code in all three of these scripts.
So what I'm going to do is update the base airplane script a little bit and what I want to do is clamp
the flaps here.
All right.
So right where we're doing our clamp inputs are kind of inputs are here let's just remove this line
here.
So and put it down here and we should have done that you know a little bit ago but that is development.
So we're always finding more ways of optimizing our code and our games and so on and so forth.
OK.
So that should take care of everything.
So let's go back to the airplane and put scripts and we don't need this anymore.
All right so just removed a line of code.
Cool.
So now we should actually have the functionality to clamp the flaps across the board across all of our
inherited scripts.
OK so let's go and test it out one more time.
All right so I'm to play
and let's go and hit the flaps down button now and see if we can get this single all around and we are
in fact now clamping.
Perfect.
So it is a nice little optimization to all of our scripts.
All right so we now have the flaps working the last button we really need to get working for all of
our mobile controls here is to add in the camera switch button so where we have this break button I'm
going to add another button over here.
And before camera switch on your mobile device.
Thanks so much.