UI_FlashTween.cs 697 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using DG.Tweening;
  6. using UnityEngine.UI;
  7. public class UI_FlashTween : MonoBehaviour
  8. {
  9. public Image[] imgs;
  10. private Tween[] _tweens;
  11. private void Start()
  12. {
  13. _tweens = new Tween[imgs.Length];
  14. for (int i = 0; i < imgs.Length; i++)
  15. {
  16. imgs[i].color=Color.white;
  17. _tweens[i] = imgs[i].DOColor(Color.gray, 0.2f).SetLoops(-1, LoopType.Yoyo);
  18. }
  19. }
  20. private void OnDestroy()
  21. {
  22. for (int i = 0; i < _tweens.Length; i++)
  23. {
  24. DOTween.Kill(_tweens[i]);
  25. imgs[i].color=Color.white;
  26. }
  27. }
  28. }