Player Input

The player can either tap or swipe.

Swiping adds force to the sheep in the direction of the swipe

Tapping is used either to stop a sheep (put it in hold state), or to use God Powers.

Technical Design
All these different inputs are detected through Unity3D’s standard Input library and will be described in greater detail below.

The swipe gesture is done using Input.touches to get information about all the points where the player is touching. These are then stored in a Dictionary called fingers, using the fingerID of the touch object as the key and creating a Vector3 array of size three as the value. The Vector3 array contains the location where the swipe began, the location where it ended, and the location of the progressPoint when the swipe began. A line is then drawn between the start and the end points of the swipe, and any objects touching that line is affected by the swipe. The effect of the swipe is that the affected sheep are rotated towards the end point of the swipe using transform.LookAt, and a constant force is added to the sheep.