using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.UI;
|
|
using UnityEngine;
|
|
|
|
public class MainMenuController : MonoBehaviour
|
|
{
|
|
public GameObject GameOptionsMenu;
|
|
public GameObject GameOpt_S1;
|
|
public GameObject GameOpt_S2;
|
|
public GameObject SettingsMenu;
|
|
public GameObject MainMenu;
|
|
public GameObject HowToPlayMenu;
|
|
|
|
public Button SoundButton;
|
|
public Button MusicButton;
|
|
public Button DifficultyButton;
|
|
|
|
bool soundVolume = true;
|
|
bool musicVolume = true;
|
|
|
|
int difficulty = 1;
|
|
|
|
//On Awake
|
|
private void Awake ()
|
|
{
|
|
MainMenu.SetActive (true);
|
|
SettingsMenu.SetActive (false);
|
|
GameOptionsMenu.SetActive (false);
|
|
GameOpt_S1.SetActive (false);
|
|
GameOpt_S2.SetActive (false);
|
|
HowToPlayMenu.SetActive (false);
|
|
}
|
|
|
|
//Main Menu Options
|
|
public void OnPlayClick ()
|
|
{
|
|
//toggle which menu displays
|
|
//MainMenu.SetActive (false);
|
|
//GameOptionsMenu.SetActive (true);
|
|
//GameOpt_S1.SetActive (true);
|
|
UnityEngine.SceneManagement.SceneManager.LoadScene ("LoginScreen");
|
|
}
|
|
|
|
public void OnSettingsClick ()
|
|
{
|
|
//toggle which menu displays
|
|
MainMenu.SetActive (false);
|
|
SettingsMenu.SetActive (true);
|
|
}
|
|
|
|
public void OnTutorialClick ()
|
|
{
|
|
MainMenu.SetActive (false);
|
|
HowToPlayMenu.SetActive (true);
|
|
}
|
|
public void OnTutorialContinueClick ()
|
|
{
|
|
UnityEngine.SceneManagement.SceneManager.LoadScene ("TuteLevelOne");
|
|
}
|
|
|
|
//Game Options and Settings Menu
|
|
public void OnBackClick ()
|
|
{
|
|
//Settings menu
|
|
GameOptionsMenu.SetActive (false);
|
|
SettingsMenu.SetActive (false);
|
|
MainMenu.SetActive (true);
|
|
}
|
|
public void OnBackClickScreenOne ()
|
|
{
|
|
//Game Options Screen One back to Main Menu
|
|
GameOptionsMenu.SetActive (false);
|
|
GameOpt_S1.SetActive (false);
|
|
MainMenu.SetActive (true);
|
|
}
|
|
public void OnBackClickScreenTwo ()
|
|
{
|
|
//Game Options Screen Two back to Screen One
|
|
GameOpt_S1.SetActive (true);
|
|
GameOpt_S2.SetActive (false);
|
|
}
|
|
|
|
//Game Options S1 to S2
|
|
public void OnContinueClick ()
|
|
{
|
|
//Game Options Screen Two back to Screen One
|
|
GameOpt_S1.SetActive (false);
|
|
GameOpt_S2.SetActive (true);
|
|
}
|
|
|
|
//Settings menu
|
|
public void OnSoundVolumeClick ()
|
|
{
|
|
if (soundVolume == true) {
|
|
SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: OFF";
|
|
soundVolume = false;
|
|
} else {
|
|
SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: ON";
|
|
soundVolume = true;
|
|
}
|
|
}
|
|
|
|
public void OnMusicVolumeClick ()
|
|
{
|
|
if (musicVolume == true) {
|
|
//backgroundMusic.Stop();
|
|
MusicButton.GetComponentInChildren<Text> ().text = "Music Volume: OFF";
|
|
musicVolume = false;
|
|
} else {
|
|
//backgroundMusic.Play();
|
|
MusicButton.GetComponentInChildren<Text> ().text = "Music Volume: ON";
|
|
musicVolume = true;
|
|
}
|
|
}
|
|
|
|
public void OnDifficultyClick ()
|
|
{
|
|
if (difficulty == 1)
|
|
{
|
|
DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: MEDIUM";
|
|
difficulty = 2;
|
|
}
|
|
else if(difficulty == 2)
|
|
{
|
|
DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: HARD";
|
|
difficulty = 3;
|
|
}
|
|
else
|
|
{
|
|
DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: EASY";
|
|
difficulty = 1;
|
|
}
|
|
}
|
|
}
|