private static void UpdateLeftJoystickPosition(Joystick_Controller leftJoystickController) { Touch[] touches = Input.touches; if (Input.touchCount == 0) { leftJoystickController.ResetPosition(); } for (int i = 0; i < Input.touchCount; i++) { if (touches[i].position.x < Screen.width / 3 && touches[i].position.y < Screen.height / 2) { leftJoystickController.UpdatePosition(touches[i].position); } } }
void Start () { GameObject leftJoystick = GameObject.Find("Left_Joystick"); leftJoystickController = leftJoystick.GetComponent<Joystick_Controller>(); }