public override void Execute(CommandQueue commandQueue, Action onComplete) { SpriteFader.FadeSprite(spriteRenderer, targetColor, fadeDuration, slideOffset); // Fade is asynchronous, but command completes immediately. // If you need to wait for the fade to complete, just use an additional Wait() command if (onComplete != null) { onComplete(); } }
public override void OnEnter() { if (spriteRenderer == null) { Continue(); return; } SpriteFader.FadeSprite(spriteRenderer, _targetColor.Value, _duration.Value, Vector2.zero, delegate { if (waitUntilFinished) { Continue(); } }); if (!waitUntilFinished) { Continue(); } }
IEnumerator CharacterFadeOut() { yield return(SpriteFader.FadeSprite(m_CharacterImage, new Color(1, 1, 1, 1), new Color(1, 1, 1, 0), 1f)); }
IEnumerator SetNewCharacterAndFadeIn(Sprite sprite) { m_CharacterImage.sprite = sprite; yield return(SpriteFader.FadeSprite(m_CharacterImage, new Color(1, 1, 1, 0), new Color(1, 1, 1, 1), 1f)); }