/// <summary>
//Joystick.cs
//Penelope iPhone Tutorial
//
//Joystick creates a movable joystick (via GUITexture) that
//handles touch input, taps, and phases. Dead zones can control
//where the joystick input gets picked up and can be normalized.]
//
//Optionally, you can enable the touchPad property from the editor
//to treat this Joystick as a TouchPad. A TouchPad allows the finger
//to touch down at any point and it tracks the movement relatively
//without moving the graphic.
/// </summary>
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(GUITexture))]
//A simple class for bounding how far the GUITexture will move
public class Boundary
{
public Vector2 min = Vector2.zero;
public Vector2 max = Vector2.zero;
}
public class Joystick : MonoBehaviour {
private static Joystick[] joysticks; //A static collection of all joysticks
private static bool enumeratedJoysticks = false;
private static float tapTimeDelta = 0.3f; //Time allowed between taps
public bool touchPad; //Is this a TouchPad?
public Rect touchZone;
public Vector2 deadZone = Vector2.zero; //Control when position is output
public bool normalize = false; //Normalize output after the dead-done
public Vector2 position; //[-1,1] in x,y
public int tapCount; //Current tap count
private int lastFingerId = -1; //Finger last used for this joystick
private float tapTimeWindow; //how much time there is left for a tap to occur
pr
/// //Joystick.cs//Penelope iPhone Tutorial////Joystick creates a movable joystick (via GUITexture) that//handles touch input, taps, and phases. Dead zones can control//where the joystick input