private void Move() { float oldX = transform.localPosition.x; switch (direction) { case "S": transform.Translate(Vector3.down * Time.deltaTime * Constants.BALLS_SPEED * speedMultiplier); break; case "E": transform.Translate(Vector3.right * Time.deltaTime * Constants.BALLS_SPEED * speedMultiplier); break; case "N": transform.Translate(Vector3.up * Time.deltaTime * Constants.BALLS_SPEED * speedMultiplier); break; } float newX = transform.localPosition.x; if ((oldX <= globalState.GetDestroyedX()) && (newX >= globalState.GetDestroyedX())) { globalState.destroyedDNRx = 2000f; } }