Skip to content

Commit 06cf41d

Browse files
committed
Prevent reloading the scene more than once.
Added feature to increase volume when button is pressed.
1 parent 1ce0a41 commit 06cf41d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Assets/DevTools.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,26 @@ private void Start()
4747

4848
private void Update()
4949
{
50-
if (Input.GetButtonDown("Oculus_CrossPlatform_Button_1"))
50+
if (PlayerPrefs.GetFloat("subtitles") == 0 &&
51+
(Input.GetKeyDown(KeyCode.Space) || Input.GetButtonDown("Oculus_CrossPlatform_Button_1")))
5152
{
5253
PlayerPrefs.SetFloat("subtitles", 1);
5354

5455
SceneManager.LoadScene("A11YTk");
5556
}
5657

57-
if (_currentVolume > 0)
58+
foreach (var videoPlayer in _videoPlayers)
5859
{
59-
_currentVolume = Mathf.Lerp(_currentVolume, 0, Time.deltaTime);
60+
videoPlayer.SetDirectAudioVolume(0, _currentVolume);
6061
}
6162

62-
foreach (var videoPlayer in _videoPlayers)
63+
if (Input.GetKey(KeyCode.Space) || Input.GetButton("Oculus_CrossPlatform_Button_1"))
6364
{
64-
videoPlayer.SetDirectAudioVolume(0, _currentVolume);
65+
_currentVolume = Mathf.Lerp(_currentVolume, 1, Time.deltaTime);
66+
}
67+
else
68+
{
69+
_currentVolume = Mathf.Lerp(_currentVolume, 0, Time.deltaTime);
6570
}
6671
}
6772
}

0 commit comments

Comments
 (0)