2023-04-01 16:31:23 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using SHADE;
|
|
|
|
|
|
|
|
|
|
namespace SHADE_Scripting.UI
|
|
|
|
|
{
|
|
|
|
|
public class TransitToMainMenu: Script
|
|
|
|
|
{
|
|
|
|
|
public float timeToTransit = 0.0f;
|
|
|
|
|
public uint sceneToChange = 0;
|
|
|
|
|
private float timer = 0.0f;
|
|
|
|
|
private bool sceneChanged = false;
|
|
|
|
|
|
|
|
|
|
protected override void start()
|
|
|
|
|
{
|
|
|
|
|
timer = timeToTransit;
|
|
|
|
|
sceneChanged = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override void update()
|
|
|
|
|
{
|
|
|
|
|
timer -= Time.DeltaTimeF;
|
|
|
|
|
if(timer <= 0.0f && sceneChanged == false)
|
|
|
|
|
{
|
|
|
|
|
SceneManager.ChangeScene(sceneToChange);
|
|
|
|
|
sceneChanged = true;
|
|
|
|
|
}
|
2023-04-01 16:32:56 +08:00
|
|
|
|
if(Input.GetKeyDown(Input.KeyCode.Space))
|
|
|
|
|
{
|
|
|
|
|
timer = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-04-01 16:31:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|