Commit b282eefb authored by Ashley's avatar Ashley

fixed pause menu

parent 66065f04
...@@ -117,11 +117,11 @@ GameObject: ...@@ -117,11 +117,11 @@ GameObject:
- component: {fileID: 114044092705028698} - component: {fileID: 114044092705028698}
m_Layer: 5 m_Layer: 5
m_Name: PauseMenu m_Name: PauseMenu
m_TagString: Untagged m_TagString: PauseMenu
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!114 &114007429724219852 --- !u!114 &114007429724219852
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
......
...@@ -1503,6 +1503,106 @@ Transform: ...@@ -1503,6 +1503,106 @@ Transform:
m_PrefabParentObject: {fileID: 4854154196249452, guid: ba720387896779247b89aad1c0b34f7a, m_PrefabParentObject: {fileID: 4854154196249452, guid: ba720387896779247b89aad1c0b34f7a,
type: 2} type: 2}
m_PrefabInternal: {fileID: 656324683} m_PrefabInternal: {fileID: 656324683}
--- !u!1001 &670422024
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1118525862}
m_Modifications:
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_AnchoredPosition.x
value: -0.000061035156
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_SizeDelta.x
value: 400
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_SizeDelta.y
value: 256
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_AnchorMin.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_AnchorMin.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_AnchorMax.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_AnchorMax.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 4b32869774338904a875250168c72931, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &672233107 --- !u!1001 &672233107
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -2076,7 +2176,7 @@ ParticleSystem: ...@@ -2076,7 +2176,7 @@ ParticleSystem:
m_GameObject: {fileID: 920148520} m_GameObject: {fileID: 920148520}
serializedVersion: 5 serializedVersion: 5
lengthInSec: 0.1 lengthInSec: 0.1
speed: 1 simulationSpeed: 1
looping: 1 looping: 1
prewarm: 0 prewarm: 0
playOnAwake: 1 playOnAwake: 1
...@@ -5328,6 +5428,7 @@ RectTransform: ...@@ -5328,6 +5428,7 @@ RectTransform:
m_Children: m_Children:
- {fileID: 1670713437} - {fileID: 1670713437}
- {fileID: 1737786060} - {fileID: 1737786060}
- {fileID: 1969649541}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
...@@ -6967,6 +7068,11 @@ Prefab: ...@@ -6967,6 +7068,11 @@ Prefab:
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 1151e628647482a439ec7203b401bb17, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 1151e628647482a439ec7203b401bb17, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
--- !u!224 &1969649541 stripped
RectTransform:
m_PrefabParentObject: {fileID: 224641396611505108, guid: 4b32869774338904a875250168c72931,
type: 2}
m_PrefabInternal: {fileID: 670422024}
--- !u!1001 &1981856129 --- !u!1001 &1981856129
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -7259,7 +7365,7 @@ ParticleSystem: ...@@ -7259,7 +7365,7 @@ ParticleSystem:
m_GameObject: {fileID: 2100709141} m_GameObject: {fileID: 2100709141}
serializedVersion: 5 serializedVersion: 5
lengthInSec: 0.1 lengthInSec: 0.1
speed: 1 simulationSpeed: 1
looping: 0 looping: 0
prewarm: 0 prewarm: 0
playOnAwake: 1 playOnAwake: 1
......
...@@ -16,9 +16,15 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -16,9 +16,15 @@ public class GameManager : SingletonBehaviour<GameManager>
void Awake() void Awake()
{ {
birb = GameObject.FindGameObjectWithTag("Player");
DontDestroyOnLoad(this); DontDestroyOnLoad(this);
} }
void Start()
{
birb = GameObject.FindGameObjectWithTag("Player");
pauseMenu = GameObject.FindGameObjectWithTag("PauseMenu");
pauseMenu.SetActive(false);
}
public bool isPaused public bool isPaused
...@@ -33,14 +39,14 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -33,14 +39,14 @@ public class GameManager : SingletonBehaviour<GameManager>
{ {
//set timescale back to normal //set timescale back to normal
Time.timeScale = 1; Time.timeScale = 1;
pauseMenu.SetActive(false); GameManager.instance.pauseMenu.SetActive(false);
Debug.Log("Game is unpaused"); Debug.Log("Game is unpaused");
} }
else if(!isPaused) else if(!isPaused)
{ {
//set timescale to zero //set timescale to zero
Time.timeScale = 0; Time.timeScale = 0;
pauseMenu.SetActive(true); GameManager.instance.pauseMenu.SetActive(true);
Debug.Log("Game is paused"); Debug.Log("Game is paused");
} }
_isPaused = value; _isPaused = value;
...@@ -90,19 +96,23 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -90,19 +96,23 @@ public class GameManager : SingletonBehaviour<GameManager>
if (!timerText) { if (!timerText) {
timerText = GameObject.FindGameObjectWithTag("Timer").GetComponent<Text>(); timerText = GameObject.FindGameObjectWithTag("Timer").GetComponent<Text>();
} }
if(!GameManager.instance.pauseMenu)
{
GameManager.instance.pauseMenu = GameObject.FindGameObjectWithTag("PauseMenu");
}
string currentTime = formatTime(Time.time - levelTimer); string currentTime = formatTime(Time.time - levelTimer);
timerText.text = "Time: " + currentTime; timerText.text = "Time: " + currentTime;
if(Input.GetButtonDown("Cancel")) if(Input.GetButtonDown("Cancel"))
{ {
if(pauseMenu.active == true) if(GameManager.instance.pauseMenu.activeSelf == true)
{ {
isPaused = false; isPaused = false;
pauseMenu.active = false; GameManager.instance.pauseMenu.SetActive(false);
} }
else else
{ {
isPaused = true; isPaused = true;
pauseMenu.active = true; GameManager.instance.pauseMenu.SetActive(true);
} }
} }
} }
......
...@@ -10,6 +10,7 @@ TagManager: ...@@ -10,6 +10,7 @@ TagManager:
- Tiles Parent - Tiles Parent
- slowHazard - slowHazard
- Timer - Timer
- PauseMenu
layers: layers:
- Default - Default
- TransparentFX - TransparentFX
......
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