Example #1
0
 private void GameStateAnimation(bool state, IDragonAnimator animator, bool skipAnimation)
 {
     if (_currentAnimation != null)
     {
         _currentAnimation.Kill();
     }
     if (state)
     {
         animator.AnimateOut().Complete();
     }
     _currentAnimation = state ? animator.AnimateIn() : animator.AnimateOut();
     _currentAnimation.OnStart(() =>
     {
         if (state)
         {
             gameObject.SetActive(true);
         }
         else
         {
             SetCanvasInteractable(false);
         }
     });
     _currentAnimation.OnComplete(() =>
     {
         if (!state)
         {
             gameObject.SetActive(false);
         }
         else
         {
             SetCanvasInteractable(true);
         }
     });
     if (skipAnimation)
     {
         _currentAnimation.Complete(true);
     }
     else
     {
         _currentAnimation.Play();
     }
 }
Example #2
0
 public void AnimateOut(IDragonAnimator animator, bool destroyOnComplete)
 {
     if (_currentAnimation != null)
     {
         _currentAnimation.Kill();
     }
     _currentAnimation = animator.AnimateOut();
     _currentAnimation.OnStart(() =>
     {
         SetCanvasInteractable(false);
     });
     _currentAnimation.OnComplete(() =>
     {
         if (destroyOnComplete)
         {
             Destroy(gameObject);
         }
         else
         {
             gameObject.SetActive(false);
         }
     });
 }