Files
the-peoples-messenger/Assets/Scripts/TutorialManager.cs
T
2026-08-29 22:29:12 +01:00

52 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Utils;
using Utils.Utils;
public class TutorialManager : Singleton<TutorialManager>
{
public List<GameEntry<GameObject>> tutorialOne;
public List<GameEntry<GameObject>> tutorialTwo;
private int index = 0;
public void LogAction(string action)
{
if (LevelLoader.Instance.GlobalModifier != "TUT1" && LevelLoader.Instance.GlobalModifier != "TUT2")
{
return;
}
var tutorial = LevelLoader.Instance.GlobalModifier == "TUT1" ? tutorialOne : tutorialTwo;
if (index < tutorial.Count && tutorial[index].key == action)
{
tutorial[index].value.SetActive(false);
index++;
if (index < tutorial.Count)
{
tutorial[index].value.SetActive(true);
}
}
}
public void ShowFirst()
{
if (LevelLoader.Instance.GlobalModifier != "TUT1" && LevelLoader.Instance.GlobalModifier != "TUT2")
{
return;
}
StartCoroutine(DoSomethingAfterOneSecond());
}
IEnumerator DoSomethingAfterOneSecond()
{
yield return new WaitForSeconds(1.5f);
var tutorial = LevelLoader.Instance.GlobalModifier == "TUT1" ? tutorialOne : tutorialTwo;
tutorial[index].value.SetActive(true);
}
}