private IEnumerator MoveAndProcessCard(MovableObject obj) { obj.ForceDropZone(this); AddObjectToDropZone(obj); Bounds objBounds = obj.ColliderBounds; Bounds colBounds = _collider.bounds; Vector2 centerOffset = objBounds.center - obj.transform.position; float minX = colBounds.min.x + (objBounds.size.x / 2f) - centerOffset.x; float maxX = colBounds.max.x - (objBounds.size.x / 2f) - centerOffset.x; //_collider.enabled = false; Vector2 newPos = obj.transform.position; //newPos.x = Mathf.Clamp(newPos.x, minX, maxX); newPos.x = colBounds.center.x; obj.transform.position = newPos; //Vector2 velocity = new Vector2(); Vector2 finalPos = obj.transform.position; finalPos.y = cardLocation.position.y; while (Vector2.Distance(obj.transform.position, finalPos) > 0.001f) { if (obj.IsSelected) { Debug.Log("SELECTED"); break; } obj.transform.position = Vector2.MoveTowards(obj.transform.position, finalPos, Time.deltaTime * animSpeed); yield return(new WaitForEndOfFrame()); } obj.transform.position = finalPos; _cardReaderAnimator.SetBool("CardIn", true); yield return(new WaitForSeconds(1.5f)); _cardReaderAnimator.SetBool("Processed", true); _processed = true; obj.DisableInteractions(); if (cardProcessed != null) { cardProcessed(); } _currentCardRoutine = null; }