56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
using System;
|
|
using SHADE;
|
|
using SHADE_Scripting.Audio;
|
|
using SHADE_Scripting.UI;
|
|
|
|
public class MainMenu : Script
|
|
{
|
|
public uint sceneID;
|
|
|
|
public GameObject obj;
|
|
private Renderable renderable;
|
|
|
|
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();
|
|
|
|
renderable = obj.GetComponent<Renderable>();
|
|
|
|
}
|
|
|
|
protected override void start()
|
|
{
|
|
//Input.SetMouseCentering(false);
|
|
//Application.IsCursorVisible = true;
|
|
SceneFadeInOut.Instance.CallFadeOut();
|
|
}
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
|