OK so the last button that we really need to hook up for our airplane mobile inputs is the camera switching
button.
So this is relatively easy but we going you make modifications to code just to make sure everything
is working appropriately so let's jump over into unity and get it going.
OK so to get the camera switching button going what I'm going to do is I'm going to just duplicate the
break button.
All right.
And I'm going to move it off to the other side.
That way it's over on the left hand side there.
And I'm just going to rename it so that way keeps it nice and clean.
So we're going to do.
Camera button.
And you know while we're here what we should do is we should actually reorganize all of these buttons.
They should actually be underneath the thumb stick.
And the reason for that if we were to actually play here I want the thumb sticks to draw over all these
things.
At least that's how I'm thinking right now.
Right.
If I left them you know where they were the thumb stick would actually be underneath the bus.
So that's the layer or the rendering of the actual UI elements.
Depends on their organization and they hire.
OK so with that out of the way let's go and just clear out these particular triggers and get rid of
the event trigger component there because we're not going to need it for this particular button.
And so I'm going to drag out the mobile camera button sprite.
Now onto this guy and I'm going to colorize this a little bit differently so I think I'm going to make
this just kind of like a dark darker color like so that's kind of cool just like that.
All right.
And so what I'm going to do is then jump over into the code and what we're going to do is we're going
to come down below the flaps here and I mean it's going to create another tiny method that will basically
set camera and this time we're going to send in a boolean value.
I'm going to call that flag.
That we go and all I need to do is just set the camera switch variable.
All right.
Too true is enough.
Now you might think that would work.
So let's let's actually try it out because I want to actually demonstrate what the error is here.
So I'm going to launch new again here and let it compile the script.
Ok so now what I need to do is just add a listener to the On Click event here for that camera button.
And that listener is going to be our mobile inputs that sitting on the typical airplane.
All right.
So I'm going to select that particular component there and then select the set camera method that we
expose there so I'm going to set it to true.
Now if I were to hit play now.
All right.
So to play an hour to click the button.
What's going to happen is it's going to constantly be switching back and forth.
All right.
And the reason for that is if we take a look at our base airplane inputs here where we are are actually
setting it with the input that key down.
So this particular function this get down is constantly returning a true or false.
So this was convenient because it was automatically setting it back to false after that get key down
that was fired.
So the camera switch is working.
That's also true for the xbox controllers.
But what we need to do with the mobile airplane inputs is actually update the camera controller on the
airplane.
So we need to come into the Uni-Pixel airplane here and we need to go into the camera controller and
we need to launch that scripts at this really quick.
All right so now we have the airplane controller and we have our mobile inputs over here.
And what I want to do is inside of the airplane camera controller is once we switch a camera here.
Once we run this which camera I'm going to set the input camera switch boolean value back to false.
All right.
So this means that we actually need to go in to our property over here that we made for cameras switching
and also add a set like so.
So we're going to say Camors which is equal to value all right.
So that's how we pass in and we'll set it back.
Not totally ideal but it will actually work for us so once we're done switching Cameron where we're
making sure that we're getting input so we can run all this stuff.
So what we can do is we can say input DOT camera which is now false so we're just setting it back and
this will work for all the inputs.
It just it really needs to be done for the mobile air mobile inputs.
OK so let's go back into unity and test this out one more time.
So let's play on the camera switch and I can switch back and forth.
Is because we're automatically setting the camera switch back to false after the switch can.
So it's not constantly being set.
True.
So that works perfectly for us.
Now we have cockpit view for mobile.
I think that was quite hard to fly on a mobile device but you know there's hardcore gamers out there
probably really like that.
Obviously much prefer to fly in the third person view but you know that is that's what we now have all
of our mobile inputs all set up.
So really our next task now is to focus on getting the touches to work.
So this means that we're going to get the remote hook up and we'll get out and make sure that we switch
the product over to the Android.
It really just makes everything for a purpose not by default.
Some of these things will actually work because the mouse studies are Moulson but it's also been used
with us as well.
But we just need to make sure that we handle the multi-touch to some sticks.
And so with that I'm the only two guys here in this lecture and in the next two into the.