40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System;
|
|
using SHADE;
|
|
using SHADE_Scripting.Audio;
|
|
|
|
public class MainMenu : Script
|
|
{
|
|
public uint sceneID;
|
|
protected override void awake()
|
|
{
|
|
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
|
|
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
|
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
|
//Audio.PlayBGMOnce2D("event:/Music/main_menu");
|
|
AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
|
|
}
|
|
protected override void update()
|
|
{
|
|
if (Input.GetKeyDown(Input.KeyCode.Space))
|
|
{
|
|
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
|
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
|
}
|
|
|
|
if (Input.GetKeyUp(Input.KeyCode.Space))
|
|
{
|
|
//Audio.PlaySFXOnce2D("event:/UI/success");
|
|
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
|
SceneManager.ChangeScene(sceneID);
|
|
Audio.StopAllSounds();
|
|
}
|
|
|
|
if (Input.GetKeyDown(Input.KeyCode.Escape))
|
|
{
|
|
Audio.StopAllSounds();
|
|
Application.Quit();
|
|
}
|
|
}
|
|
}
|
|
|