|
|
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
-
- public class ImageAnimator : MonoBehaviour
- {
-
- [SerializeField]
- private GameObject[] m_Panels;
-
- [SerializeField]
- private float m_time = 0.5f;
-
- private int m_count;
-
-
-
- private void OnEnable()
- {
- m_count = 0;
- StartCoroutine(PanelSequence(m_time));
- }
-
-
-
- private IEnumerator PanelSequence(float waitTime)
- {
-
- foreach (var panel in m_Panels)
- panel.SetActive(false);
-
- m_Panels[m_count].SetActive(true);
- m_count = (m_count + 1) % m_Panels.Length;
-
- yield return new WaitForSeconds(waitTime);
-
- StartCoroutine(PanelSequence(waitTime));
- }
-
-
- }
|