Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Image m_Image;
- public Sprite[] m_SpriteArray;
- public float m_Speed = .02f;
- private int m_IndexSprite;
- Coroutine m_CorotineAnim;
- bool IsDone;
- public void Func_PlayUIAnim()
- {
- IsDone = false;
- m_CorotineAnim = StartCoroutine(Func_PlayAnimUI());
- }
- public void Func_StopUIAnim()
- {
- IsDone = true;
- StopCoroutine(m_CorotineAnim);
- }
- IEnumerator Func_PlayAnimUI()
- {
- yield return new WaitForSeconds(m_Speed);
- if (m_IndexSprite >= m_SpriteArray.Length)
- {
- m_IndexSprite = 0;
- }
- m_Image.sprite = m_SpriteArray[m_IndexSprite];
- m_IndexSprite += 1;
- if (IsDone == false)
- m_CorotineAnim = StartCoroutine(Func_PlayAnimUI());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement