private void TweenCanvasGroupAlpha(float startValue, float targetValue) { if (!alphaTween.ValidTarget()) { alphaTween = new FloatTween { easeType = easeType, duration = duration, startValue = startValue, targetValue = targetValue }; alphaTween.AddOnChangedCallback((float value) => { canvasGroup.alpha = value; }); alphaTween.AddOnFinishCallback(() => { if (alphaTween.startValue > alphaTween.targetValue) { onCloseFinished.Invoke(); if (deactivateOnClose && deactivate) { gameObject.SetActive(false); } } else { onShowFinished.Invoke(); } }); } else { alphaTween.startValue = startValue; alphaTween.targetValue = targetValue; } m_AlphaTweenRunner.StartTween(alphaTween); }
private void TweenCanvasGroupAlpha(float startValue, float targetValue) { var alphaTween = new FloatTween { easeType = easeType, duration = duration, startValue = startValue, targetValue = targetValue }; alphaTween.AddOnChangedCallback((float value) => { canvasGroup.alpha = value; }); alphaTween.AddOnFinishCallback(() => { if (startValue > targetValue) { onCloseFinished.Invoke(); } else { onShowFinished.Invoke(); } }); m_AlphaTweenRunner.StartTween(alphaTween); }