public override void EvaluateAndApply(TOptions options, Tween t, bool isRelative, DOGetter <T> getter, DOSetter <T> setter, float elapsed, TweenPlugPath startValue, TweenPlugPath changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice) { //TODO: figure out how to access tween's loopType /*if(t.loopType == LoopType.Incremental && !changeValue.isClosed) { * int increment = (t.IsComplete() ? t.CompletedLoops() - 1 : t.CompletedLoops()); * if(increment > 0) changeValue = changeValue.CloneIncremental(increment); * }*/ float pathPerc = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod); var pt = changeValue.GetPoint(pathPerc); var val = GetValue(pt); setter(val); }
private static Vector3 GetLookAhead(Transform trans, float t, TweenPlugPath path) { if (path.type == TweenPlugPathType.Linear) { // Calculate lookAhead so that it doesn't turn until it starts moving on next waypoint return(trans.localPosition + path.wps[path.linearWPIndex].valueVector3 - path.wps[path.linearWPIndex - 1].valueVector3); } else { float lookAheadPerc = t + lookAhead; if (lookAheadPerc > 1) { lookAheadPerc = (path.isClosed ? lookAheadPerc - 1 : path.type == TweenPlugPathType.Linear ? 1 : 1.00001f); } return(path.GetPoint(lookAheadPerc).valueVector3); } }