SerializedProperty IterateOverrides( OverrideFunction overrideFunction, PathFunction pathFunction, EndFunction endFunction) { var overridesProperty = serializedObject.FindProperty("overrides"); for (int i = 0, n = overridesProperty.arraySize; i < n; ++i) { var overrideProperty = overridesProperty.GetArrayElementAtIndex(i); var filterProperty = overrideProperty.FindPropertyRelative("filter"); var filter = filterProperty.stringValue; if (i < _cacheTables.Count) { var table = _cacheTables[i]; if (overrideFunction(overrideProperty, i, n, table.Count)) { foreach (var x in table) { pathFunction(x.Key, x.Value, i); } } } endFunction(overrideProperty); } return(overridesProperty); }
public void StartTween(bool reverse = false, EndFunction function = null) { if (tween != null) { StopCoroutine(tween); } tween = null; tween = StartCoroutine(DoTween(reverse, function)); }
public void AddTween(float length, TweenFunction tweenFunction, EndFunction end) { tween t = new tween(); t.length = length; t.startTime = Time.time; t.tweenFunction = tweenFunction; t.done = false; t.endFunction = end; tweens.Add(t); }
IEnumerator DoTween(bool reverse, EndFunction function = null) { Vector3 desiredPosition = reverse ? StartPosition : EndPosition; float elapsedTime = 0; while (elapsedTime < TweenTime) { transform.localPosition = Vector3.Lerp(transform.localPosition, desiredPosition, (elapsedTime / TweenTime)); elapsedTime += Time.deltaTime; yield return(new WaitForEndOfFrame()); } if (function != null) { function(); } transform.localPosition = desiredPosition; StopTween(); }
IEnumerator DoTween(bool reverse, EndFunction function = null) { Quaternion desiredRotation = reverse ? Quaternion.Euler(angles * StartAngle) : Quaternion.Euler(angles * EndAngle); float elapsedTime = 0; while (elapsedTime < TweenTime) { transform.localRotation = Quaternion.Lerp(transform.localRotation, desiredRotation, (elapsedTime / TweenTime)); elapsedTime += Time.deltaTime; yield return(new WaitForEndOfFrame()); } if (function != null) { function(); } transform.localRotation = desiredRotation; StopTween(); }