diff --git a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/AudioManager.cs b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/AudioManager.cs
index ba9a6ac..e3741a8 100644
--- a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/AudioManager.cs
+++ b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/AudioManager.cs
@@ -17,31 +17,35 @@ public class AudioManager : MonoBehaviour
///
public static AudioManager Instance;
- // declare separate audio sources for music and sfx
- // so we can control their volumes separately
- [Header("Audio Sources")]
+ ///
+ /// music audio source
+ ///
+ [SerializeField] private AudioSource musicSource;
- // music audio source
- [SerializeField]
- private AudioSource musicSource;
-
- // music source default volume
+ ///
+ /// music source default volume
+ ///
[SerializeField] private float musicSourceDefaultVolume = 0.6f;
- // sfx audio source
+ ///
+ /// sound effects (sfx) audio source
+ ///
[SerializeField] private AudioSource sfxSource;
- // sfx source default volume
+ ///
+ /// sound effects (sfx) source default volume
+ ///
[SerializeField] private float sfxSourceDefaultVolume = 0.6f;
- // declare audio clips for music and sfx
- [Header("Audio Clips")]
+ ///
+ /// audio clip for menu button click
+ ///
+ [SerializeField] public AudioClip menuButtonClick;
- // audio clip for menu button clicks
- public AudioClip menuButtonClick;
-
- // audio clip for menu button hover
- public AudioClip menuButtonHover;
+ ///
+ /// audio clip for menu button hover
+ ///
+ [SerializeField] public AudioClip menuButtonHover;
///
/// function to set don't destroy on load and check for multiple instances
diff --git a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/CommonMenu.cs b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/CommonMenu.cs
index c226354..2ffacbf 100644
--- a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/CommonMenu.cs
+++ b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/CommonMenu.cs
@@ -1,4 +1,4 @@
-/*
+/*
* author: mark joshwel
* date: 29/5/2024
* description: common menu script for hover and click sound effects on ui toolkit buttons
diff --git a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/CreditsMenu.cs b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/CreditsMenu.cs
index 21878f3..0e4a5bc 100644
--- a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/CreditsMenu.cs
+++ b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/CreditsMenu.cs
@@ -22,6 +22,7 @@ public class CreditsMenu : CommonMenu
///
public override void OnEnable()
{
+ // set the associated state and call the base OnEnable
associatedState = GameManager.DisplayState.ScreenCreditsMenu;
base.OnEnable();
diff --git a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/GameManager.cs b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/GameManager.cs
index 3b4230b..7c023f1 100644
--- a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/GameManager.cs
+++ b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/GameManager.cs
@@ -80,11 +80,11 @@ private void Start()
///
private void HideMenuHelper()
{
- // get parent object tagged "Menus"
+ // get all child menus in the "Menus" parent object
foreach (var menu in GameObject.FindGameObjectsWithTag("Menus"))
- // hide each menu under the parent object\
foreach (Transform menuChild in menu.transform)
{
+ // disable the menu
Debug.Log($"GameManager: HideMenuHelper - hiding menu '{menuChild}'");
menuChild.gameObject.SetActive(false);
}
@@ -118,23 +118,23 @@ private void PauseGameHelper(DisplayState incomingState)
// hide any menu that is currently showing
HideMenuHelper();
- // show the menu based on the incoming state
- // 1. get all menus via the parent object tagged "Menus"
+ // get all child menus in the "Menus" parent object
foreach (var menuParent in GameObject.FindGameObjectsWithTag("Menus"))
- // 2. get all menus under the parent object
foreach (Transform menu in menuParent.transform)
{
- // 2. check its associated state
+ // show the menu based on the incoming state
+ // get the associated state of the menu
var associatedState = menu.gameObject.GetComponent().associatedState;
Debug.Log(
$"GameManager: PauseGameHelper - found menu '{menu}' "
+ $"with associated state {associatedState} "
+ $"against incoming state {incomingState}");
- // 3. if the associated state is the same as the incoming state, then show the menu
+ // guard clause if the menu isn't what we're looking for
if (associatedState != incomingState)
continue;
+ // if the associated state is the same as the incoming state, then show the menu
Debug.Log($"GameManager: PauseGameHelper - showing menu for {incomingState}");
menu.gameObject.SetActive(true);
}
diff --git a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/MainMenu.cs b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/MainMenu.cs
index 6771d75..90006e2 100644
--- a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/MainMenu.cs
+++ b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/MainMenu.cs
@@ -38,6 +38,7 @@ public class MainMenu : CommonMenu
///
public override void OnEnable()
{
+ // set the associated state and call the base OnEnable
associatedState = GameManager.DisplayState.ScreenMainMenu;
base.OnEnable();
diff --git a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/OptionsMenu.cs b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/OptionsMenu.cs
index 18b38ec..ad8c6c4 100644
--- a/SheKnowsWhatYouAreToHerGame/Assets/Scripts/OptionsMenu.cs
+++ b/SheKnowsWhatYouAreToHerGame/Assets/Scripts/OptionsMenu.cs
@@ -33,6 +33,7 @@ public class OptionsMenu : CommonMenu
///
public override void OnEnable()
{
+ // set the associated state and call the base OnEnable
associatedState = GameManager.DisplayState.ScreenOptionsMenu;
base.OnEnable();