private void Update() { #region MK testing if (canSwipe) { if (Input.GetMouseButtonDown(0)) { ray = cam.ScreenPointToRay(Input.mousePosition); Physics.Raycast(ray, out hit); if (hit.transform != null) { Ingredient temp = hit.transform.GetComponent <Ingredient>(); if (temp.ActualID >= 0) { board.selectedIngredient = temp; startSwipePos = Input.mousePosition; } } } if (Input.GetMouseButtonDown(1)) { if (board.GetTargetIngredient(CheckInputDirection(Input.mousePosition)) >= 0) { canSwipe = false; StartCoroutine(board.Impile()); } } } #endregion if (Input.touchCount > 0 && canSwipe) { Touch touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began) { ray = cam.ScreenPointToRay(touch.position); Physics.Raycast(ray, out hit); if (hit.transform != null) { Ingredient temp = hit.transform.GetComponent <Ingredient>(); if (temp.ActualID >= 0) { startSwipePos = touch.position; board.selectedIngredient = temp; } } } else if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Canceled || touch.phase == TouchPhase.Ended) { if (Vector3.Distance(startSwipePos, touch.position) > maxSwipeDist) { if (board.GetTargetIngredient(CheckInputDirection(touch.position)) >= 0) { canSwipe = false; StartCoroutine(board.Impile()); } } } } }