Finally uploading my menu stuff
- Dustin
This commit is contained in:
parent
35361ba35c
commit
8ee9db6cd8
BIN
Assets/Resources/Prefabs/Pause Menu.prefab
Normal file
BIN
Assets/Resources/Prefabs/Pause Menu.prefab
Normal file
Binary file not shown.
8
Assets/Resources/Prefabs/Pause Menu.prefab.meta
Normal file
8
Assets/Resources/Prefabs/Pause Menu.prefab.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5d691733bfedfa54899b27347b86db9e
|
||||||
|
timeCreated: 1463521657
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Assets/Resources/Scenes/MainMenu.unity
Normal file
BIN
Assets/Resources/Scenes/MainMenu.unity
Normal file
Binary file not shown.
74
Assets/Resources/Scripts/MenuScript.cs
Normal file
74
Assets/Resources/Scripts/MenuScript.cs
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class MenuScript : MonoBehaviour {
|
||||||
|
|
||||||
|
public Canvas quitMenu;
|
||||||
|
public Canvas creditsMenu;
|
||||||
|
public Button startText;
|
||||||
|
public Button exitText;
|
||||||
|
public Button creditText;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
|
||||||
|
Debug.Log("biiiiiitch");
|
||||||
|
quitMenu = quitMenu.GetComponent<Canvas>();
|
||||||
|
startText = startText.GetComponent<Button>();
|
||||||
|
exitText = exitText.GetComponent<Button>();
|
||||||
|
creditsMenu = creditsMenu.GetComponent<Canvas>();
|
||||||
|
|
||||||
|
quitMenu.enabled = false;
|
||||||
|
creditsMenu.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ExitPress() //Pressing the Quit Menu option
|
||||||
|
{
|
||||||
|
quitMenu.enabled = true;
|
||||||
|
startText.enabled = false;
|
||||||
|
exitText.enabled = false;
|
||||||
|
creditsMenu.enabled = false;
|
||||||
|
creditText.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreditsPress() //Pressing the Credits Menu option
|
||||||
|
{
|
||||||
|
creditsMenu.enabled = true;
|
||||||
|
quitMenu.enabled = false;
|
||||||
|
startText.enabled = false;
|
||||||
|
exitText.enabled = false;
|
||||||
|
creditText.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NoPress()
|
||||||
|
{
|
||||||
|
quitMenu.enabled = false;
|
||||||
|
creditsMenu.enabled = false;
|
||||||
|
startText.enabled = true;
|
||||||
|
exitText.enabled = true;
|
||||||
|
creditText.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void StartLevel()
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene(1);
|
||||||
|
Debug.Log("bitch");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExitGame()
|
||||||
|
{
|
||||||
|
Application.Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
42
Assets/Resources/Scripts/PauseMenu.cs
Normal file
42
Assets/Resources/Scripts/PauseMenu.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class PauseMenu : MonoBehaviour {
|
||||||
|
|
||||||
|
public string mainMenu;
|
||||||
|
|
||||||
|
public bool isPaused;
|
||||||
|
public GameObject pauseMenuCanvas;
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
|
||||||
|
if (isPaused)
|
||||||
|
{
|
||||||
|
pauseMenuCanvas.SetActive(true); //if this is true, then the pause menu will show up
|
||||||
|
Time.timeScale = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pauseMenuCanvas.SetActive(false);
|
||||||
|
Time.timeScale = 1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.Escape))
|
||||||
|
isPaused = !isPaused;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Resume()
|
||||||
|
{
|
||||||
|
isPaused = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Quit()
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene(0);
|
||||||
|
}
|
||||||
|
}
|
BIN
Assets/Titles/Menu.anim
Normal file
BIN
Assets/Titles/Menu.anim
Normal file
Binary file not shown.
Reference in New Issue
Block a user