//handle any touch input based on state void TouchInputCheck() { if (Input.touchCount > 0) { switch (Input.GetTouch(0).phase) { case TouchPhase.Began: switch (state) { case currentState.DialougeOpen: Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); RaycastHit rayHit; if (Physics.Raycast(ray, out rayHit)) { if (rayHit.collider == dialougeBox.GetComponent <Collider>()) { dialougeBox.HandleInput(); } } else if (typewriter.finishedPrint) { dialougeBox.HideDialouge(); } else { typewriter.PrintAll(); } break; case currentState.DialougeClosed: break; } break; default: break; } } }