Added the pausing and playing of music when the game is paused or not
This commit is contained in:
@@ -1312,6 +1312,7 @@ MonoBehaviour:
|
|||||||
CongratsText: {fileID: 0}
|
CongratsText: {fileID: 0}
|
||||||
pauseFirstButton: {fileID: 223326611}
|
pauseFirstButton: {fileID: 223326611}
|
||||||
gameOverFirstButton: {fileID: 0}
|
gameOverFirstButton: {fileID: 0}
|
||||||
|
music: {fileID: 1467720640}
|
||||||
--- !u!114 &989087329
|
--- !u!114 &989087329
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -7540,6 +7540,7 @@ MonoBehaviour:
|
|||||||
CongratsText: {fileID: 1992981387}
|
CongratsText: {fileID: 1992981387}
|
||||||
pauseFirstButton: {fileID: 312387577}
|
pauseFirstButton: {fileID: 312387577}
|
||||||
gameOverFirstButton: {fileID: 630916946}
|
gameOverFirstButton: {fileID: 630916946}
|
||||||
|
music: {fileID: 2074891275}
|
||||||
--- !u!1 &1728628295
|
--- !u!1 &1728628295
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -1557,6 +1557,7 @@ MonoBehaviour:
|
|||||||
CongratsText: {fileID: 0}
|
CongratsText: {fileID: 0}
|
||||||
pauseFirstButton: {fileID: 783395647}
|
pauseFirstButton: {fileID: 783395647}
|
||||||
gameOverFirstButton: {fileID: 0}
|
gameOverFirstButton: {fileID: 0}
|
||||||
|
music: {fileID: 1128321816}
|
||||||
--- !u!114 &1111617282
|
--- !u!114 &1111617282
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -1090,6 +1090,7 @@ MonoBehaviour:
|
|||||||
CongratsText: {fileID: 0}
|
CongratsText: {fileID: 0}
|
||||||
pauseFirstButton: {fileID: 1040909057}
|
pauseFirstButton: {fileID: 1040909057}
|
||||||
gameOverFirstButton: {fileID: 0}
|
gameOverFirstButton: {fileID: 0}
|
||||||
|
music: {fileID: 595592872}
|
||||||
--- !u!114 &963355971
|
--- !u!114 &963355971
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public class PauseMenu : MonoBehaviour
|
|||||||
public GameObject pauseFirstButton;
|
public GameObject pauseFirstButton;
|
||||||
public GameObject gameOverFirstButton;
|
public GameObject gameOverFirstButton;
|
||||||
|
|
||||||
|
public AudioSource music;
|
||||||
|
|
||||||
private bool highscore = false;
|
private bool highscore = false;
|
||||||
private int gameOver = 0;
|
private int gameOver = 0;
|
||||||
|
|
||||||
@@ -90,6 +92,7 @@ public class PauseMenu : MonoBehaviour
|
|||||||
Time.timeScale = 1f;
|
Time.timeScale = 1f;
|
||||||
GameIsPaused = false;
|
GameIsPaused = false;
|
||||||
GameIsOver = false;
|
GameIsOver = false;
|
||||||
|
music.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pause()
|
void Pause()
|
||||||
@@ -101,6 +104,7 @@ public class PauseMenu : MonoBehaviour
|
|||||||
GameIsPaused = true;
|
GameIsPaused = true;
|
||||||
EventSystem.current.SetSelectedGameObject(null);
|
EventSystem.current.SetSelectedGameObject(null);
|
||||||
EventSystem.current.SetSelectedGameObject(pauseFirstButton);
|
EventSystem.current.SetSelectedGameObject(pauseFirstButton);
|
||||||
|
music.Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameOver()
|
void GameOver()
|
||||||
@@ -111,6 +115,7 @@ public class PauseMenu : MonoBehaviour
|
|||||||
gameOverUI.SetActive(true);
|
gameOverUI.SetActive(true);
|
||||||
Time.timeScale = 0f;
|
Time.timeScale = 0f;
|
||||||
GameIsPaused = true;
|
GameIsPaused = true;
|
||||||
|
music.Pause();
|
||||||
|
|
||||||
if(FloorLevel.gameOver == true)
|
if(FloorLevel.gameOver == true)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user