2025-05-01 01:48:08 -07:00

40 lines
894 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using DG.Tweening;
using UnityEngine.UI;
public class LoadNewScene : MonoBehaviour
{
public Image blackScreen;
public bool fadeIn = true;
public void Start()
{
if (fadeIn && blackScreen != null)
{
blackScreen.gameObject.SetActive(true);
blackScreen.DOFade(0, 3f).SetUpdate(true);
}
}
public void OpenNewScene(string newScene)
{
Time.timeScale = 1;
DOTween.Clear(true);
DOTween.KillAll();
SceneManager.LoadScene(newScene);
}
public void ReloadScene()
{
Time.timeScale = 1;
DOTween.Clear(true);
DOTween.KillAll();
//DOTween.KillAll();
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}