This commit is contained in:
2023-05-29 10:18:43 +02:00
2 changed files with 1740 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -7,6 +7,7 @@ using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using UnityEngine.UI; using UnityEngine.UI;
using UnityEngine.Audio;
public class jatekmanager : MonoBehaviour public class jatekmanager : MonoBehaviour
{ {
@@ -21,6 +22,9 @@ public class jatekmanager : MonoBehaviour
public GameObject homeGomb; public GameObject homeGomb;
public GameObject settingsGomb; public GameObject settingsGomb;
public GameObject shopGomb; public GameObject shopGomb;
public GameObject volumeSlide;
public GameObject musicSlide;
public GameObject sfxSlide;
public GameObject goLeftButton; public GameObject goLeftButton;
public GameObject jumpButton; public GameObject jumpButton;
@@ -38,6 +42,10 @@ public class jatekmanager : MonoBehaviour
private Timer timer; private Timer timer;
private CoinCounter cc; private CoinCounter cc;
public AudioMixer audioMixer;
private void Awake() private void Awake()
{ {
Application.targetFrameRate = 60; Application.targetFrameRate = 60;
@@ -48,6 +56,7 @@ public class jatekmanager : MonoBehaviour
score = FindObjectOfType<Score>(); score = FindObjectOfType<Score>();
timer = FindObjectOfType<Timer>(); timer = FindObjectOfType<Timer>();
cc = FindObjectOfType<CoinCounter>(); cc = FindObjectOfType<CoinCounter>();
} }
private void Start() private void Start()
@@ -55,6 +64,19 @@ public class jatekmanager : MonoBehaviour
UpdateGameState(GameState.Home); UpdateGameState(GameState.Home);
} }
public void SetMainVolume(float mainVolume)
{
audioMixer.SetFloat("Master", mainVolume);
}
public void SetMusicVolume(float musicVolume)
{
audioMixer.SetFloat("Music", musicVolume);
}
public void SetSfxVolume(float sfxVolume)
{
audioMixer.SetFloat("Sfx", sfxVolume);
}
public void UpdateGameState(GameState newState) public void UpdateGameState(GameState newState)
{ {
State = newState; State = newState;
@@ -119,6 +141,9 @@ public class jatekmanager : MonoBehaviour
scoreText.gameObject.SetActive(false); scoreText.gameObject.SetActive(false);
timerText.gameObject.SetActive(false); timerText.gameObject.SetActive(false);
garazs.SetActive(true); garazs.SetActive(true);
volumeSlide.SetActive(false);
musicSlide.SetActive(false);
sfxSlide.SetActive(false);
} }
IEnumerator TimerHome() IEnumerator TimerHome()
@@ -132,6 +157,9 @@ public class jatekmanager : MonoBehaviour
{ {
UpdateGameState(GameState.Settings); UpdateGameState(GameState.Settings);
playGomb.SetActive(false); playGomb.SetActive(false);
volumeSlide.SetActive(true);
musicSlide.SetActive(true);
sfxSlide.SetActive(true);
} }
private async void HandleSettings() private async void HandleSettings()
@@ -143,6 +171,9 @@ public class jatekmanager : MonoBehaviour
scoreText.gameObject.SetActive(false); scoreText.gameObject.SetActive(false);
timerText.gameObject.SetActive(false); timerText.gameObject.SetActive(false);
playGomb.SetActive(false); playGomb.SetActive(false);
volumeSlide.SetActive(false);
musicSlide.SetActive(false);
sfxSlide.SetActive(false);
} }
public void ChangeToShop() public void ChangeToShop()
@@ -159,6 +190,9 @@ public class jatekmanager : MonoBehaviour
goRightButton.SetActive(false); goRightButton.SetActive(false);
scoreText.gameObject.SetActive(false); scoreText.gameObject.SetActive(false);
timerText.gameObject.SetActive(false); timerText.gameObject.SetActive(false);
volumeSlide.SetActive(false);
musicSlide.SetActive(false);
sfxSlide.SetActive(false);
} }
public void ChangeToGame() public void ChangeToGame()
@@ -168,6 +202,9 @@ public class jatekmanager : MonoBehaviour
shopGomb.SetActive(false); shopGomb.SetActive(false);
playGomb.SetActive(false); playGomb.SetActive(false);
UpdateGameState(GameState.Game); UpdateGameState(GameState.Game);
volumeSlide.SetActive(false);
musicSlide.SetActive(false);
sfxSlide.SetActive(false);
} }