All that's left now is to wire up the event to the Input subsystem of UrhoSharp. This is done by adding a single line of code to the Start() method, as shown in the following steps:
- In the WhackABox project, open the Game.cs file.
- In the Start() method, add the code highlighted in bold in the following code block:
protected override void Start()
{
scene = new Scene(Context);
var octree = scene.CreateComponent<Octree>();
InitializeCamera();
InitializeLights();
InitializeRenderer();
Input.TouchBegin += OnTouchBegin;
InitializeAR();
}
This wires up the TouchBegin event to our OnTouchBegin event handler.
If you run the game now, the boxes should animate and disappear when you tap on them. What we need now is some kind of statistic that shows how many planes there are and how many boxes are still alive.