Added basic scene switching, v.1.3.0
This commit is contained in:
70
Assets/Scripts/Menu/ButtonHandlerMenu.cs
Normal file
70
Assets/Scripts/Menu/ButtonHandlerMenu.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.Menu
|
||||
{
|
||||
public class ButtonHandlerMenu : MonoBehaviour
|
||||
{
|
||||
UIHandlerMenu uihandler;
|
||||
AudioHandler audioHandler;
|
||||
SceneHandler sceneHandler;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
uihandler = GameObject.Find("UIHandler").GetComponent<UIHandlerMenu>();
|
||||
audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandler>();
|
||||
sceneHandler = GameObject.Find("SceneHandlerLoaded").GetComponent<SceneHandler>();
|
||||
}
|
||||
|
||||
public void startGame()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.startGame(sceneHandler);
|
||||
}
|
||||
|
||||
public void closeGame()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#endif
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
public void openOptions()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.openOptions();
|
||||
}
|
||||
|
||||
public void closeOptions()
|
||||
{
|
||||
audioHandler.loadAudioSettings();
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.closeOptions();
|
||||
}
|
||||
|
||||
public void openCreation()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.openCharacterCreation();
|
||||
}
|
||||
|
||||
public void closeCreation()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.closeCharacterCreation();
|
||||
}
|
||||
|
||||
public void saveOptions()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.adaptScreen();
|
||||
audioHandler.saveAudioSettings();
|
||||
uihandler.closeOptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user