Joystick

Author: Unity Technologies.

Translated into C# by Juan Manuel Palacios, with a slightly modified API.

Description
This is the Joystick script developed by Unity Technologies in JavaScript, originally released with the Penelope tutorial and recently updated in the Unity 3.4.x release, translated into C# with a slightly modified API.

Usage
Script explanation & usage instructions should be sought in the Penelope tutorial. The API variations to the original script are decribed below:


 * A fadeGUI boolean parameter was included to discern whether or not "touchPad" joysticks should be faded.
 * The IsFingerDown method was migrated to an equivalent read-only isFingerDown C# property that can be queried as follows:
 * The LatchedFinger method was similarly migrated to a write-only latchedFinger C# property that can be set as follows:
 * The public position member variable was transparently migrated to a public but read-only C# property for off-the-shelf client consumption.
 * Game-wide joysticks collection was moved to the Awake method away from Update, the former itself employed instead of Start. This change is important because it involves the collection of the joysticks gameObjects based on the "joysticks" tag (customizable), which will cause an exception to be thrown when creating a joystick if not defined.
 * Public Enable & Disable methods are provided for the corresponding actions, without needing to deactivate the entire joystick gameObject.
 * The ResetJoystick method was renamed Restart. Note: I'm far from happy with this new method naming; the ideal would of course be simply Reset, but that's already a MonoBehaviour reserved method for in-Editor component resetting. Feel free to suggest a better naming in the |Discussion page.