Fix pause menu can only be displayed after game started
This commit is contained in:
@@ -7,6 +7,9 @@ public class GameManager : MonoBehaviour
|
|||||||
public static int MinautorKills = 0;
|
public static int MinautorKills = 0;
|
||||||
public static int BringerOfDeathKills = 0;
|
public static int BringerOfDeathKills = 0;
|
||||||
|
|
||||||
|
// Can pause menu
|
||||||
|
public static bool GameStarted = false;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
DontDestroyOnLoad(gameObject);
|
DontDestroyOnLoad(gameObject);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class PlayerManager : MonoBehaviour
|
|||||||
ArrowFrequency = 0.5f;
|
ArrowFrequency = 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.Escape))
|
if (Input.GetKeyDown(KeyCode.Escape) && GameManager.GameStarted)
|
||||||
{
|
{
|
||||||
pauseMenu.SetActive(true);
|
pauseMenu.SetActive(true);
|
||||||
Time.timeScale = 0f;
|
Time.timeScale = 0f;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -26,6 +25,7 @@ public class StartUI : MonoBehaviour
|
|||||||
_text.SetText("1");
|
_text.SetText("1");
|
||||||
yield return new WaitForSecondsRealtime(1f);
|
yield return new WaitForSecondsRealtime(1f);
|
||||||
Time.timeScale = 1f;
|
Time.timeScale = 1f;
|
||||||
|
GameManager.GameStarted = true;
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user