Global Game Jam 2021
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

41 lines
732 B

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));
}
}