private void SwapDrops() { sbyte x1, x2, y1, y2; Vector2 _tempPos; playerInput = true; /* Get Board Position */ x1 = TouchStartDrop.GetX(); x2 = TouchEndDrop.GetX(); y1 = TouchStartDrop.GetY(); y2 = TouchEndDrop.GetY(); /* tempPos will help us to save data of first drop position*/ _tempPos = TouchStartDrop.transform.position; /* Replace position of 'first and second drop' with each other */ if (Mathf.Abs(x1 - x2) + Mathf.Abs(y1 - y2) < 2) // prevents cross movement { gameBoard[x2][y2] = TouchStartDrop; TouchStartDrop.MoveDrops(x2, y2, TouchEndDrop.transform.position); gameBoard[x1][y1] = TouchEndDrop; TouchEndDrop.MoveDrops(x1, y1, _tempPos); } }