using System.Collections; using System.Collections.Generic; using Newtonsoft.Json.Linq; using UnityEngine; using UnityEngine.UI; using Utils; public class EndSceneManager : Singleton { public TextAsset data; public bool isPos; public Image kingRend; public Sprite hap; public Sprite sad; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { LevelLoader.Instance.Guards = new List(); LevelLoader.Instance.Doors = new List(); var text = data.ToString(); DialogManager.Instance.dialogTree = JObject.Parse(text)["dialog"] as JObject; DialogManager.Instance.StartDialog(GetComponent()); isPos = Random.Range(0f, 1f) > 0.5f; StartCoroutine(DoSomethingAfterOneSecond()); } IEnumerator DoSomethingAfterOneSecond() { yield return new WaitForSeconds(1f); // Code to run after 1 second DialogManager.Instance.gameObject.SetActive(true); } public void SetFace() { kingRend.sprite = isPos ? hap : sad; } // Update is called once per frame void Update() { } }