public void ChangeBallDirection(GameObject ball) { BListObject listObj = balls.Find(ball); if (listObj != null) { listObj.mustBeCenterPoint = true; while (listObj != null && (listObj.value == ball || listObj.value.GetComponent <BallReturningScript>() == null)) { if (listObj.value.GetComponent <BallScript>().ballObj.forwardBackward < 0) { listObj.value.GetComponent <BallScript>().ballObj.forwardBackward = -listObj.value.GetComponent <BallScript>().ballObj.forwardBackward; listObj.value.GetComponent <BallScript>().ballObj.destination++; } MovementManager.CalculateLerpVector(listObj.value.GetComponent <BallScript>().ballObj); if (listObj.leftNeighbour != null) { listObj.value.GetComponent <BallScript>().ballObj.actualSpeedLevel++; while (Vector3.Distance(listObj.value.transform.position, listObj.leftNeighbour.value.transform.position) < spawningSafeDistance) { MovementManager.MoveBall(listObj); } listObj.value.GetComponent <BallScript>().ballObj.actualSpeedLevel--; } listObj.value.GetComponent <BallScript>().ballObj.DecreaseSpeedLevel(); listObj = listObj.rightNeighbour; } ballsThatCouldBeInSequence.Add(balls.Find(ball)); } }