Looking-Glass/Assets/VRTemplateAssets/Scripts/StepManager.cs
2024-02-02 12:54:47 +01:00

40 lines
1,005 B
C#

using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
namespace Unity.VRTemplate
{
/// <summary>
/// Controls the steps in the in coaching card.
/// </summary>
public class StepManager : MonoBehaviour
{
[Serializable]
class Step
{
[SerializeField]
public GameObject stepObject;
[SerializeField]
public string buttonText;
}
[SerializeField]
public TextMeshProUGUI m_StepButtonTextField;
[SerializeField]
List<Step> m_StepList = new List<Step>();
int m_CurrentStepIndex = 0;
public void Next()
{
m_StepList[m_CurrentStepIndex].stepObject.SetActive(false);
m_CurrentStepIndex = (m_CurrentStepIndex + 1) % m_StepList.Count;
m_StepList[m_CurrentStepIndex].stepObject.SetActive(true);
m_StepButtonTextField.text = m_StepList[m_CurrentStepIndex].buttonText;
}
}
}