perf: DelegateExtensions.InvokeSafe marked obsolete for memory allocation reasons, soon to be removed

This commit is contained in:
2025-05-29 21:48:08 +03:00
parent 1b0f25e854
commit bf8fbebae3
35 changed files with 116 additions and 115 deletions

View File

@@ -26,14 +26,14 @@ internal class Tween : ITween
_state = value;
switch (value)
{
case TweenState.Completed: OnCompleted?.InvokeSafe(this); OnEnded?.InvokeSafe(this); break;
case TweenState.Cancelled: OnCancelled?.InvokeSafe(this); OnEnded?.InvokeSafe(this); break;
case TweenState.Paused: OnPaused?.InvokeSafe(this); break;
case TweenState.Completed: OnCompleted?.Invoke(this); OnEnded?.Invoke(this); break;
case TweenState.Cancelled: OnCancelled?.Invoke(this); OnEnded?.Invoke(this); break;
case TweenState.Paused: OnPaused?.Invoke(this); break;
case TweenState.Playing:
if (previousState == TweenState.Idle)
OnStarted?.InvokeSafe(this);
OnStarted?.Invoke(this);
else
OnResumed?.InvokeSafe(this);
OnResumed?.Invoke(this);
break;
}
}
@@ -58,9 +58,9 @@ internal class Tween : ITween
_counter = value.Min(Duration).Max(0f);
Progress = Counter / Duration;
OnUpdated?.InvokeSafe(this);
OnUpdated?.Invoke(this);
OnDeltaUpdated?.InvokeSafe(this, Easing.Evaluate(Progress) - Easing.Evaluate(previousProgress));
OnDeltaUpdated?.Invoke(this, Easing.Evaluate(Progress) - Easing.Evaluate(previousProgress));
if (_counter >= Duration)
State = TweenState.Completed;