void SlideCar() { if (slideDirection != 0) { slideTime += Time.deltaTime / slideDuration; if (slideTime >= 1) { if (slideTwice) { slideTwice = false; slideTime = 0; slideFrom = slideTo; slideTo += slideDirection * 2; } else { slideDirection = 0; slideTime = 1; } } carLocalPosition.x = Utility.Interpolate(slideFrom, slideTo, slideTime, Interpolation.EaseInEaseOut); carTransform.localPosition = carLocalPosition; carTransform.localRotation = Quaternion.Euler(0, Interpolation.Bell(slideTime) * maxSlideAngle * slideDirection, 0); } }