67 lines
1.8 KiB
C#
67 lines
1.8 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.K) && obj)
|
|
{
|
|
if (testRenderable.Material.GetProperty<float>("data.alpha") == 1)
|
|
{
|
|
testRenderable.Material.SetProperty<float>("data.alpha", 0);
|
|
}
|
|
else if (testRenderable.Material.GetProperty<float>("data.alpha") == 0)
|
|
{
|
|
testRenderable.Material.SetProperty<float>("data.alpha", 1);
|
|
}
|
|
}*/
|
|
|
|
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();
|
|
}
|
|
}
|
|
}
|
|
|