34 lines
734 B
C#
34 lines
734 B
C#
using System;
|
|
using SHADE;
|
|
|
|
public class ChangeSceneButton : Script
|
|
{
|
|
public uint sceneID = 0;
|
|
|
|
|
|
protected override void start()
|
|
{
|
|
UIElement ui = GetComponent<UIElement>();
|
|
if (ui != null)
|
|
{
|
|
ui.OnClick.RegisterAction(() =>
|
|
{
|
|
if (sceneID != 0)
|
|
{
|
|
Audio.PlaySFXOnce2D("event:/UI/success");
|
|
SceneManager.ChangeScene(sceneID);
|
|
Audio.StopAllSounds();
|
|
}
|
|
});
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Failed to register button action for ChangeSceneButton.");
|
|
}
|
|
}
|
|
protected override void update()
|
|
{
|
|
|
|
}
|
|
}
|