Add tutorial system. Fox bugs raised by the group chat
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
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;
|
||||
}
|
||||
|
||||
var tutorial = LevelLoader.Instance.GlobalModifier == "TUT1" ? tutorialOne : tutorialTwo;
|
||||
tutorial[index].value.SetActive(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user