Cute_demon_attacks/meng_yao/Assets/script/JumpScene/SceneGuodu.cs
舒荣森 c4709d7803 add
2024-10-31 13:27:31 +08:00

46 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using DG.Tweening;
using System.Threading.Tasks;
public class SceneGuodu : MonoBehaviour
{
public static SceneGuodu instance;
public string sceneName;
public float transitionTime = 1f; // 过渡时间
public GameObject mask;//遮罩
private void Start()
{
if (instance == null)
{
DontDestroyOnLoad(this);
instance = this;
}
SceneManager.sceneLoaded += loadEnd;
}
void loadEnd(Scene scene, LoadSceneMode mode)
{
Debug.Log("场景加载完成:" + scene.name);
if (mask != null )
{
mask.transform.GetComponent<CircleDissolveEffect>().isTransitioning = true;
}
}
public async void SlideInAndLoadScene(string sceneName)
{
this.sceneName = sceneName;
mask.transform.GetComponent<CircleDissolveEffect>().isTransitioning = false;
await Task.Delay(1000);
SceneManager.LoadScene(sceneName);
}
}