Commit 2a1b77c7 authored by Sebastian Woelfel's avatar Sebastian Woelfel
Browse files

pause menu

parent 6566bf5c
......@@ -12,7 +12,6 @@ GameObject:
- component: {fileID: 2805424873419819786}
- component: {fileID: 2805424873419819789}
- component: {fileID: 2805424873419819788}
- component: {fileID: 2805424873419819784}
m_Layer: 5
m_Name: PauseCanvas
m_TagString: PauseCanvas
......@@ -105,22 +104,6 @@ MonoBehaviour:
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &2805424873419819784
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2805424873419819791}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5da826accf4fb6b40a7d275b8834ea12, type: 3}
m_Name:
m_EditorClassIdentifier:
isPaused: 0
player: {fileID: 0}
pauseCanvas: {fileID: 2805424873419819791}
canvas: {fileID: 2805424873419819786}
--- !u!1 &2805424873891792810
GameObject:
m_ObjectHideFlags: 0
......@@ -624,7 +607,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 2805424873419819784}
- m_Target: {fileID: 0}
m_MethodName: OpenMainMenu
m_Mode: 1
m_Arguments:
......@@ -910,7 +893,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 2805424873419819784}
- m_Target: {fileID: 0}
m_MethodName: RespawnPlayer
m_Mode: 1
m_Arguments:
......@@ -1039,7 +1022,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 2805424873419819784}
- m_Target: {fileID: 0}
m_MethodName: ExitGame
m_Mode: 1
m_Arguments:
......@@ -1325,7 +1308,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 2805424873419819784}
- m_Target: {fileID: 0}
m_MethodName: DeactivateMenu
m_Mode: 1
m_Arguments:
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7141263671977769336
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7141263671977769338}
- component: {fileID: 7141263671977769339}
m_Layer: 0
m_Name: PauseMenu
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7141263671977769338
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7141263671977769336}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 5040656590778020668}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7141263671977769339
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7141263671977769336}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5da826accf4fb6b40a7d275b8834ea12, type: 3}
m_Name:
m_EditorClassIdentifier:
isPaused: 0
player: {fileID: 0}
pauseCanvas: {fileID: 0}
--- !u!1001 &7141263672926926903
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7141263671977769338}
m_Modifications:
- target: {fileID: 2805424873419819791, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_Name
value: PauseCanvas
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2805424874828915913, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 7141263671977769339}
- target: {fileID: 2805424874881622417, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 7141263671977769339}
- target: {fileID: 2805424875015996408, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 7141263671977769339}
- target: {fileID: 2805424875455470784, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 7141263671977769339}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c4fb9ff41852e23469532dc8ed25cb5e, type: 3}
--- !u!224 &5040656590778020668 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 2805424873419819787, guid: c4fb9ff41852e23469532dc8ed25cb5e,
type: 3}
m_PrefabInstance: {fileID: 7141263672926926903}
m_PrefabAsset: {fileID: 0}
fileFormatVersion: 2
guid: e840e9a4fa2e8c344bce9579899d9897
MonoImporter:
guid: ee2a31c10517e42889fc2f428c7d4f54
PrefabImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -22,7 +22,6 @@ public class MainMenu : MonoBehaviour
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Debug.Log("Quit!");
Application.Quit();
#endif
}
......
......@@ -9,7 +9,6 @@ public class OpenPauseMenu : MonoBehaviour
public GameObject player;
public GameObject pauseCanvas;
public Canvas canvas;
private void Awake()
{
......@@ -18,6 +17,7 @@ public class OpenPauseMenu : MonoBehaviour
private void Start()
{
if(player == null) player = GameObject.FindWithTag("Player");
pauseCanvas.SetActive(false);
}
......@@ -25,29 +25,30 @@ public class OpenPauseMenu : MonoBehaviour
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (!isPaused)
isPaused = !isPaused;
if (isPaused)
{
ActivateMenu();
isPaused = true;
}
else
if(!isPaused)
{
DeactivateMenu();
isPaused = false;
}
}
}
public void ActivateMenu()
private void ActivateMenu()
{
isPaused = true;
Time.timeScale = 0f;
pauseCanvas.SetActive(true);
}
public void DeactivateMenu()
{
Time.timeScale = 1f;
print("JOOO");
isPaused = false;
pauseCanvas.SetActive(false);
Time.timeScale = 1f;
}
public void RespawnPlayer()
......@@ -66,7 +67,10 @@ public class OpenPauseMenu : MonoBehaviour
public void ExitGame()
{
Debug.Log("Quit!");
Application.Quit();
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class PauseMenu : MonoBehaviour
{
public GameObject player;
public GameObject pauseCanvas;
public Canvas canvas;
private void Awake()
{
pauseCanvas = GameObject.FindWithTag("PauseCanvas");
}
private void Start()
{
pauseCanvas.SetActive(false);
}
public void Continue()
{
pauseCanvas.SetActive(false);
Time.timeScale = 1f;
}
public void RespawnPlayer()
{
Time.timeScale = 1f;
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
public void OpenMainMenu()
{
SceneManager.LoadScene("Menu Main");
}
public void ExitGame()
{
Debug.Log("Quit!");
Application.Quit();
}
}
Supports Markdown
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