minor bug fixes, settings menu fixed, tutorial fixes

This commit is contained in:
2023-05-18 00:08:40 -04:00
parent 7f2dc9d2e3
commit 461a297e12
17 changed files with 629 additions and 534 deletions

View File

@ -19,13 +19,16 @@ public class InGameManager : MonoBehaviour
private bool isPaused = false;
private bool isTransitioning = false;
[SerializeField]
private float pauseTransitionDuration = 1f;
// [SerializeField]
//private float pauseTransitionDuration = 1f;
[SerializeField]
private Canvas gameCanvas;
[SerializeField]
private Canvas pausedCanvas;
[SerializeField]
private List<AudioSource> sounds = new List<AudioSource>();
private List<float> initSoundVolumes = new List<float>();
public bool IsPaused { get { return this.isPaused; } }
@ -99,7 +102,13 @@ public class InGameManager : MonoBehaviour
}
public void SetVolume(float volume)
{
for (int i = 0;i<sounds.Count;i++)
{
sounds[i].volume = initSoundVolumes[i]*volume;
}
}
// Start is called before the first frame update
void Start()
{
@ -110,7 +119,12 @@ public class InGameManager : MonoBehaviour
pausedVolume.weight = 0;
gameCanvas.gameObject.SetActive(true);
pausedCanvas.gameObject.SetActive(false);
foreach (AudioSource source in sounds)
{
initSoundVolumes.Add(source.volume);
}
}
// Update is called once per frame
@ -119,7 +133,7 @@ public class InGameManager : MonoBehaviour
if (Input.GetButtonDown("Pause"))
{
this.TogglePause();
print("Toggled!");
}
if (isTransitioning||true)

View File

@ -12,7 +12,10 @@ public class InGameMenuManager : MonoBehaviour
private Animator menuAnimator;
[SerializeField]
private Scrollbar sensitivitySlider;
[SerializeField]
private Scrollbar volumeSlider;
private PlayerComponent player;
private InGameManager gameManager;
// Start is called before the first frame update
void Start()
@ -21,6 +24,7 @@ public class InGameMenuManager : MonoBehaviour
settingsButton.onClick.AddListener(SettingsClicked);
returnToMenuButton.onClick.AddListener(SettingsUnClicked);
player = GameObject.FindObjectOfType(typeof(PlayerComponent)) as PlayerComponent;
gameManager = GameObject.FindObjectOfType<InGameManager>();
}
void SettingsClicked()
{
@ -33,7 +37,11 @@ public class InGameMenuManager : MonoBehaviour
}
public void UpdateSensitivity()
{
this.player.SetSensitivity(sensitivitySlider.value);
this.player.SetSensitivity(sensitivitySlider.value*4f);
}
public void UpdateVolume()
{
gameManager.SetVolume(volumeSlider.value*2);
}
// Update is called once per frame