The entire
PlayerInput
class should look similar to the following code:
using UnityEngine; using System.Collections; using System; public class PlayerInput : MonoBehaviour { public struct SimpleTouch { public Vector2 StartTouchLocation; public Vector2 CurrentTouchLocation; public DateTime StartTime; public TouchPhase Phase; } public float SwipeTime; public float SwipeDistance; private SimpleTouch ActiveTouch; private Touch DeviceTouch; private void CalculateTouchInput(SimpleTouch CurrentTouch) { Vector2 touchDirection = (CurrentTouch.CurrentTouchLocation - CurrentTouch.StartTouchLocation).normalized; float touchDistance = (CurrentTouch.StartTouchLocation - CurrentTouch.CurrentTouchLocation).magnitude; TimeSpan timeGap = System.DateTime.Now - CurrentTouch.StartTime; double touchTimeSpan = timeGap.TotalSeconds; string touchType = ( touchDistance > SwipeDistance && touchTimeSpan...