Scriptum/Assets/Scripts/Objects/Letter/PrologueLetterManager.cs

26 lines
741 B
C#
Raw Normal View History

2022-12-12 00:13:00 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PrologueLetterManager : MonoBehaviour
{
public GameObject LetterPanel;
public GameObject _panel;
// Start is called before the first frame update
void Start()
{
if (PlayerPrefs.GetInt("PrologueLetter.WhereDisplayed") == 0)
{
_panel = Instantiate(LetterPanel, GameObject.FindGameObjectWithTag("GUI").transform);
_panel.transform.Find("Button").GetComponent<UnityEngine.UI.Button>().onClick.AddListener(DestroyLetter);
}
}
void DestroyLetter()
{
Destroy(_panel);
PlayerPrefs.SetInt("PrologueLetter.WhereDisplayed", 1);
}
}