Files
2026-08-30 01:54:16 +01:00

56 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using UnityEngine;
using UnityEngine.UI;
using Utils;
public class EndSceneManager : Singleton<EndSceneManager>
{
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<GuardManager>();
LevelLoader.Instance.Doors = new List<DoorManager>();
var text = data.ToString();
DialogManager.Instance.dialogTree = JObject.Parse(text)["dialog"] as JObject;
DialogManager.Instance.StartDialog(GetComponent<GuardManager>());
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()
{
}
}