Time for action – creating a cannon prefab
Perform the following steps to create a cannon prefab:
Create a new Unity project titled
TouchCannon
.You're probably used to setting up scenes at this point, so we'll start by quickly establishing the base elements we need.
Import your OUYA Core package into the Unity scene.
Set the project to Android from a standalone, and make sure your player settings match the settings we went over in Chapter 2, Installing Unity and the OUYA ODK. We need to actually deploy to the OUYA to test this prototype because it relies on the OUYA controller's touchpad.
Create a new plane positioned at 0, 0, 0 and increase its X scale to
10
because we want the cannon and target to be on opposite ends of a horizontal platform.Create a directional light with default settings—you may recall that positions of directional lights is irrelevant, so you can put it wherever you like.
Finally, position the main camera at 0, 10, -25 so that the entire platform is in view from above.
After...