void Update()
{
if (Input.touchSupported)
{
if (Input.touchCount == 0)
{
IsRightPressed = false;
IsLeftPressed = false;
}
else
{
var x = Input.GetTouch(0).position.x;
IsRightPressed = x > TouchCriteria;
IsLeftPressed = x < TouchCriteria;
}
}
else
{
IsRightPressed = Input.GetKey(KeyCode.RightArrow);
IsLeftPressed = Input.GetKey(KeyCode.LeftArrow);
}
}