pause menu

This commit is contained in:
2023-04-13 12:41:19 +02:00
parent 30d32ac8e5
commit 8062c626a6
3 changed files with 2471 additions and 55 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net.Sockets;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
@@ -60,15 +59,14 @@ public class jatekmanager : MonoBehaviour
public static event Action<GameState> OnGameStateChanged;
public Button helyszinaktivalasBtn;
public GameObject pauseMenuUI;
public static bool GameIsPlaying = true;
public TMP_Text nev;
private void Awake()
{
Instance = this;
//hatterzene lejatszas
audioManager = FindObjectOfType<AudioManager>();
audioManager.Play("BackgroundMusic");
Instance = this;
}
private void Start()
@@ -84,6 +82,10 @@ public class jatekmanager : MonoBehaviour
source = FindObjectOfType<Source>();
vegpontozas = FindObjectOfType<vegpontozas>();
//hatterzene lejatszas
audioManager = FindObjectOfType<AudioManager>();
audioManager.Play("BackgroundMusic");
UpdateGameState(GameState.Nev);
#if !UNITY_EDITOR
@@ -118,6 +120,9 @@ public class jatekmanager : MonoBehaviour
case GameState.Nev:
HandleUgynokNev();
break;
case GameState.Pause:
HandlePause();
break;
default:
throw new ArgumentOutOfRangeException(nameof(newState), newState, null);
}
@@ -133,7 +138,28 @@ public class jatekmanager : MonoBehaviour
Ugynok,
Vesztette,
UgynokValasztas,
Nev
Nev,
Pause
}
private async void HandlePause(){
//kikapcsolni minden gombot es collidert
}
public void Resume(){
pauseMenuUI.SetActive(false);
Time.timeScale = 1f; //normal ido visszainditasa
GameIsPlaying = true;
Instance.UpdateGameState(jatekmanager.GameState.Akcio); //akcio stare menjen vissza
}
public void Pause(){
pauseMenuUI.SetActive(true);
//ido megallitasa hogy megalljon a jatek
Time.timeScale = 0f;
GameIsPlaying = false;
//audioManager.audioMixer.volume = 0f; hangerot teljesen levenni a masteren
Instance.UpdateGameState(jatekmanager.GameState.Pause); //milyen statre menjen vissza? akcio?s
}
private async void HandleKorkezdet()
@@ -295,6 +321,16 @@ public class jatekmanager : MonoBehaviour
if(jatekosnyert){
SceneManager.LoadScene("JatekosNyert");
}*/
if(Input.GetKeyDown(KeyCode.Escape)){
if(GameIsPlaying){
Pause();
Debug.Log("Game is paused");
}else{
Resume();
Debug.Log("Game is playing");
}
}
}
private async void ugynokDeaktivalas(bool bekapcsolas)

View File

@@ -19,7 +19,7 @@ MonoBehaviour:
width: 1366
height: 680
m_ShowMode: 4
m_Title: Hierarchy
m_Title: Project
m_RootView: {fileID: 3}
m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000}
@@ -145,7 +145,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 0
controlID: 28
controlID: 49
--- !u!114 &7
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -170,7 +170,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 16192, y: 16192}
vertical: 1
controlID: 29
controlID: 50
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -195,7 +195,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 100}
m_MaxSize: {x: 16192, y: 8096}
vertical: 0
controlID: 30
controlID: 97
--- !u!114 &9
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -213,7 +213,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 202
width: 263
height: 388
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
@@ -232,23 +232,23 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name: SceneView
m_Name: GameView
m_EditorClassIdentifier:
m_Children: []
m_Position:
serializedVersion: 2
x: 202
x: 263
y: 0
width: 777
width: 716
height: 388
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 15}
m_ActualView: {fileID: 13}
m_Panes:
- {fileID: 15}
- {fileID: 13}
m_Selected: 0
m_LastSelected: 1
m_Selected: 1
m_LastSelected: 0
--- !u!114 &11
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -259,7 +259,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name: ConsoleWindow
m_Name: ProjectBrowser
m_EditorClassIdentifier:
m_Children: []
m_Position:
@@ -268,15 +268,15 @@ MonoBehaviour:
y: 388
width: 979
height: 242
m_MinSize: {x: 101, y: 121}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 17}
m_MinSize: {x: 231, y: 271}
m_MaxSize: {x: 10001, y: 10021}
m_ActualView: {fileID: 16}
m_Panes:
- {fileID: 16}
- {fileID: 17}
- {fileID: 12}
m_Selected: 1
m_LastSelected: 0
m_Selected: 0
m_LastSelected: 1
--- !u!114 &12
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -307,8 +307,8 @@ MonoBehaviour:
m_SaveData: []
m_MixersTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 687a0000
m_LastClickedID: 31336
m_SelectedIDs: 60780000
m_LastClickedID: 30816
m_ExpandedIDs: 12eb343c
m_RenameOverlay:
m_UserAcceptedRename: 0
@@ -424,7 +424,7 @@ MonoBehaviour:
oldMaxSizes:
oldSplitSize: 0
m_HorizontalSplitter:
ID: 76
ID: 325
splitterInitialOffset: 0
currentActiveSplitter: -1
realSizes:
@@ -473,9 +473,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 202
x: 263
y: 86
width: 775
width: 714
height: 367
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
@@ -487,7 +487,7 @@ MonoBehaviour:
m_ShowGizmos: 0
m_TargetDisplay: 0
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
m_TargetSize: {x: 775, y: 346}
m_TargetSize: {x: 714, y: 346}
m_TextureFilterMode: 0
m_TextureHideFlags: 61
m_RenderIMGUI: 1
@@ -502,8 +502,8 @@ MonoBehaviour:
m_VRangeLocked: 0
hZoomLockedByDefault: 0
vZoomLockedByDefault: 0
m_HBaseRangeMin: -387.5
m_HBaseRangeMax: 387.5
m_HBaseRangeMin: -357
m_HBaseRangeMax: 357
m_VBaseRangeMin: -173
m_VBaseRangeMax: 173
m_HAllowExceedBaseRangeMin: 1
@@ -514,7 +514,7 @@ MonoBehaviour:
m_HSlider: 0
m_VSlider: 0
m_IgnoreScrollWheelUntilClicked: 0
m_EnableMouseInput: 0
m_EnableMouseInput: 1
m_EnableSliderZoomHorizontal: 0
m_EnableSliderZoomVertical: 0
m_UniformScale: 1
@@ -523,23 +523,23 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 21
width: 775
width: 714
height: 346
m_Scale: {x: 1, y: 1}
m_Translation: {x: 387.5, y: 173}
m_Translation: {x: 357, y: 173}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -387.5
x: -357
y: -173
width: 775
width: 714
height: 346
m_MinimalGUI: 1
m_defaultScale: 1
m_LastWindowPixelSize: {x: 775, y: 367}
m_LastWindowPixelSize: {x: 714, y: 367}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000
@@ -567,7 +567,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 86
width: 201
width: 262
height: 367
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
@@ -576,9 +576,9 @@ MonoBehaviour:
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_SelectedIDs: 467a0000
m_LastClickedID: 0
m_ExpandedIDs: 5cc1ffff26f6ffff28fbffff987a0000067c00004a7c0000
m_ExpandedIDs: ecc5ffff32c6ffff10cbffffa6cfffff0cd6ffff70d6ffff22efffffc4efffff9ef1ffffa8f1ffff72f3ffff92f3ffff28fbffff6ec000007ec70000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@@ -594,7 +594,7 @@ MonoBehaviour:
m_IsRenaming: 0
m_OriginalEventType: 11
m_IsRenamingFilename: 0
m_ClientGUIView: {fileID: 9}
m_ClientGUIView: {fileID: 0}
m_SearchString:
m_ExpandedScenes: []
m_CurrenRootInstanceID: 0
@@ -622,9 +622,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 202
x: 263
y: 86
width: 775
width: 714
height: 367
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
@@ -882,9 +882,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: -8.464, y: 0, z: 0}
m_Target: {x: 0.28075045, y: -0.64408726, z: 0.015206538}
speed: 2
m_Value: {x: -8.464, y: 0, z: 0}
m_Value: {x: 0.28075045, y: -0.64408726, z: 0.015206538}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@@ -935,9 +935,9 @@ MonoBehaviour:
speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 10
m_Target: 12.497973
speed: 2
m_Value: 10
m_Value: 12.497973
m_Ortho:
m_Target: 1
speed: 2
@@ -1003,22 +1003,22 @@ MonoBehaviour:
m_SkipHidden: 0
m_SearchArea: 1
m_Folders:
- Assets/Assets/Sounds
- Assets
m_Globs: []
m_OriginalText:
m_ViewMode: 1
m_StartGridSize: 64
m_LastFolders:
- Assets/Assets/Sounds
- Assets
m_LastFoldersGridSize: -1
m_LastProjectPath: /home/tom/Documents/dev/find the source
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 43}
m_SelectedIDs: 647a0000
m_LastClickedID: 31332
m_ExpandedIDs: 00000000307a0000507a0000547a000000ca9a3b
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 467a0000
m_LastClickedID: 31302
m_ExpandedIDs: 00000000467a00005e7a000000ca9a3b
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@@ -1046,7 +1046,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 00000000307a0000
m_ExpandedIDs: 00000000467a0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name: