private void IdleFinish(float secondsOverflow) { state = State.Lower; Vector3 currentPosition = mover.GetPosition(); target = currentPosition - Vector3.up * data.heightToRise; velocity = UtilPredict.ConstantVelocity(currentPosition, target, data.secondsOfLowering); }
private void WarningFinish(float secondsOverflow) { state = State.Rise; Vector3 currentPosition = mover.GetPosition(); target = currentPosition + Vector3.up * heightToRise; velocity = UtilPredict.ConstantVelocity(currentPosition, target, data.secondsOfRising); }
// When this method is called, the GameObject moves towards the destination // with a velocity to reach the destination in the given amount of seconds. public void LerpToInTime(Vector2 destination, float seconds) { this.destination = destination; velocity = UtilPredict.ConstantVelocity(mover.GetPosition(), destination, seconds); lerping = true; }