Commit a0de6a22 authored by Isa's avatar Isa
Browse files

PausenMenü Anfang

parent 72d3c154
This diff is collapsed.
fileFormatVersion: 2
guid: c66c4b488749fc04f98d48936a85d282
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 83b2ccd8caab22846876189bc6815151
guid: 0f8760904cfbe5e45a5e4c648b7d4f06
folderAsset: yes
DefaultImporter:
externalObjects: {}
......
......@@ -24,7 +24,7 @@ public class MainMenu : MonoBehaviour
{
_old = _new;
}
if(Input.GetKey(KeyCode.Escape) && _backScreen != null)
if(Input.GetButtonDown ("Cancel") && _backScreen != null)
{
_backScreen.SetActive(true);
_currentScreen.SetActive(false);
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class PauseMenu : MonoBehaviour
{
public GameObject pauseMenu, optionsMenu;
private EventSystem _myEventSystem;
public Button firstSelect;
private GameObject _backScreen, _currentScreen;
public bool isPaused = false;
// Start is called before the first frame update
void Start()
{
_myEventSystem = EventSystem.current;
}
IEnumerator highlightBtn()
{
_myEventSystem.SetSelectedGameObject(null);
yield return null;
_myEventSystem.firstSelectedGameObject = firstSelect.gameObject;
_myEventSystem.SetSelectedGameObject(_myEventSystem.firstSelectedGameObject);
}
// Update is called once per frame
void Update()
{
if(Input.GetButtonDown ("Cancel") && isPaused == true && _backScreen == null)
{
Resume();
} else if (Input.GetButtonDown ("Cancel") && isPaused == false && _backScreen == null)
{
Pause();
}
else if (Input.GetButtonDown ("Cancel") && isPaused == true && _backScreen != null)
{
_backScreen.SetActive(true);
_currentScreen.SetActive(false);
firstSelect.Select();
_backScreen = null;
}
}
public void SetBackScreen(GameObject bScreen)
{
_backScreen = bScreen;
}
public void SetCurrentScreen(GameObject cScreen)
{
_currentScreen = cScreen;
}
public void Resume()
{
isPaused = false;
pauseMenu.SetActive(false);
optionsMenu.SetActive(false);
Time.timeScale = 1f;
}
public void Pause()
{
isPaused = true;
pauseMenu.SetActive(true);
Time.timeScale = 0f;
StartCoroutine("highlightBtn");
}
}
fileFormatVersion: 2
guid: 737427f11fc02c94baa4fa58c2fe9a8f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment