using System; using SHADE; using SHADE_Scripting.Audio; public class MainMenu : Script { public uint sceneID; public GameObject obj; private Renderable renderable; //tbr public GameObject test; public Renderable testRenderable; 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(); //tbr testRenderable = test.GetComponent(); } protected override void start() { } protected override void update() { if (Input.GetKeyDown(Input.KeyCode.K) && obj) { if (testRenderable.Material.GetProperty("data.alpha") == 1) { testRenderable.Material.SetProperty("data.alpha", 0); } else if (testRenderable.Material.GetProperty("data.alpha") == 0) { testRenderable.Material.SetProperty("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(); } } }