EvolutionEffectObject.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using TMPro;
  6. public class EvolutionEffectObject : MonoBehaviour
  7. {
  8. CardSource CardSource;
  9. [SerializeField] Animator anim;
  10. [SerializeField] Image CardImage;
  11. [SerializeField] List<TextMeshProUGUI> texts = new List<TextMeshProUGUI>();
  12. internal float animTime = 1.45f;
  13. public void Init()
  14. {
  15. this.gameObject.SetActive(false);
  16. }
  17. public virtual IEnumerator EvolutionEffectAnimation(CardSource cardSource, CardSource[] jogressEvoRoots = null, string message = "")
  18. {
  19. if (cardSource == null)
  20. {
  21. yield break;
  22. }
  23. if (ContinuousController.instance != null)
  24. {
  25. if (!ContinuousController.instance.showCutInAnimation)
  26. {
  27. yield return new WaitForSeconds(animTime);
  28. yield break;
  29. }
  30. }
  31. if (!string.IsNullOrEmpty(message))
  32. {
  33. if (texts != null)
  34. {
  35. foreach (TextMeshProUGUI text in texts)
  36. {
  37. if (text != null)
  38. {
  39. text.text = message;
  40. }
  41. }
  42. }
  43. }
  44. anim.enabled = true;
  45. this.gameObject.SetActive(true);
  46. CardImage.sprite = cardSource.CardSprite;
  47. anim.SetInteger("Evolution", 1);
  48. yield return new WaitForSeconds(animTime);
  49. anim.SetInteger("Evolution", -1);
  50. anim.enabled = false;
  51. this.gameObject.SetActive(false);
  52. }
  53. public void PlaySE()
  54. {
  55. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().EvolutionSE_Ultimate);
  56. }
  57. }