Beispiel #1
0
    void FixedUpdate()
    {
        if (currTime > duration)
        {
            state = pingPongState.BACKWARD;
        }
        else if (currTime < 0)
        {
            state = pingPongState.FORWARD;
        }

        if (state == pingPongState.FORWARD)
        {
            currTime += Time.deltaTime;
        }
        else
        {
            currTime -= Time.deltaTime;
        }

        fraction           = customLerp.getFraction(currTime, duration, type);
        transform.position = Vector3.Lerp(startPos.position, endPos.position, fraction);
    }
Beispiel #2
0
 void Start()
 {
     state = pingPongState.FORWARD;
 }