public static async ETVoid CancelAfter(this ETCancellationToken self, long afterTimeCancel) { if (self.IsCancel()) { return; } await TimerComponent.Instance.WaitAsync(afterTimeCancel); if (self.IsCancel()) { return; } self.Cancel(); }
public async ETVoid PlayThenIdleAsync(AnimationClip animation) { AnimancerComponent.Play(IdleAnimation); AnimancerComponent.Play(animation, 0.25f); if (token != null) { token.Cancel(); } token = new ETCancellationToken(); var isTimeout = await TimerComponent.Instance.WaitAsync((int)(animation.length * 1000), token); if (isTimeout) { AnimancerComponent.Play(IdleAnimation, 0.25f); } }