EvolutionEffectObject.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 break;
  28. }
  29. }
  30. if (!string.IsNullOrEmpty(message))
  31. {
  32. if (texts != null)
  33. {
  34. foreach (TextMeshProUGUI text in texts)
  35. {
  36. if (text != null)
  37. {
  38. text.text = message;
  39. }
  40. }
  41. }
  42. }
  43. anim.enabled = true;
  44. this.gameObject.SetActive(true);
  45. CardImage.sprite = cardSource.CardSprite;
  46. anim.SetInteger("Evolution", 1);
  47. yield return new WaitForSeconds(animTime);
  48. anim.SetInteger("Evolution", -1);
  49. anim.enabled = false;
  50. this.gameObject.SetActive(false);
  51. }
  52. public void PlaySE()
  53. {
  54. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().EvolutionSE_Ultimate);
  55. }
  56. }