Files
beyond/Assets/Scripts/Tutorial/QuestPopupStep.cs
2024-11-20 15:21:28 +01:00

47 lines
1.8 KiB
C#

using PixelCrushers;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Beyond
{
public class QuestPopupStep : MonoBehaviour
{
public BaseStepController baseStepController;
public UIPanel toggleQuestsButton;
public RectTransform questRectTransform;
public List<GameObject> tutorialQuestInfoTexts;
// public Image menuButonDisable;
// Start is called before the first frame update
private void Start()
{
baseStepController.ConditionsAreMet += () => { return toggleQuestsButton.isOpen == true; };
baseStepController.OnStarted += () => { toggleQuestsButton.Close(); StartCoroutine(EnableExamplaryQuestInfoCoroutine()); };
baseStepController.OnCompleted += () => { tutorialQuestInfoTexts.ForEach(text => Destroy(text)); };
baseStepController.OnAdditionalStepPanelEnabled += () => { StartCoroutine(ShowExamplaryPopupsCoroutine()); };
}
private IEnumerator EnableExamplaryQuestInfoCoroutine()
{
yield return new WaitForSeconds(0.5f);
tutorialQuestInfoTexts.ForEach(text =>
{
if (!text) return;
text.transform.parent = questRectTransform;
text.SetActive(true);
});
}
private IEnumerator ShowExamplaryPopupsCoroutine()
{
yield return new WaitForSeconds(1.2f);
bItemCollectionDisplay.Instance.FadeText("Acquired: 2 Meat", 4, 0.25f);
yield return new WaitForSeconds(0.5f);
bItemCollectionDisplay.Instance.FadeText("Used: Meat", 4, 0.25f);
yield return new WaitForSeconds(0.5f);
bItemCollectionDisplay.Instance.FadeText("Used: Meat", 4, 0.25f);
}
}
}