Skip to content

Commit

Permalink
Plane sound doesn't pause when pausing SebLague#45 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Sakkas committed Feb 5, 2023
1 parent 9f461d6 commit 5af824c
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions Assets/Scripts/Menu/PauseMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,41 @@

public class PauseMenu : Menu
{

public Button quitButton;

void Start()
{
quitButton.onClick.AddListener(GameController.ExitToMainMenu);
}


public void TogglePauseMenu()
{
if (IsOpen)
{
CloseMenu();
}
else
{
OpenMenu();
}
}


protected override void OnMenuOpened()
{
base.OnMenuOpened();
GameController.SetPauseState(true);
}

protected override void OnMenuClosed()
{
base.OnMenuClosed();
GameController.SetPauseState(false);
}

public Button quitButton;
[SerializeField] PlayerAudio playerAudio;

void Start()
{
quitButton.onClick.AddListener(GameController.ExitToMainMenu);
}

public void TogglePauseMenu()
{
if (IsOpen)
{
CloseMenu();
}
else
{
OpenMenu();
}
}
protected override void OnMenuOpened()
{
base.OnMenuOpened();
ToggleSound(false);
GameController.SetPauseState(true);
}

protected override void OnMenuClosed()
{
base.OnMenuClosed();
ToggleSound(true);
GameController.SetPauseState(false);
}

private void ToggleSound(bool toggleSound)
{
playerAudio.gameObject.SetActive(toggleSound);
}
}

0 comments on commit 5af824c

Please sign in to comment.