Exemplo n.º 1
0
    private void Start()
    {
        AudioSetting audioSetting = new AudioSetting();

        audioSetting.Load();
        GameDataManager.instance.gameData.optionData.audioSetting = audioSetting;
    }
Exemplo n.º 2
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);

            library = GetComponent <SoundLibrary>();

            musicSources = new AudioSource[2];
            for (int i = 0; i < 2; i++)
            {
                GameObject newMusicSource = new GameObject("Music source " + (i + 1));
                musicSources[i] = newMusicSource.AddComponent <AudioSource>();
                newMusicSource.transform.parent = transform;
            }
            GameObject newSfx2Dsource = new GameObject("2D sfx source");
            sfx2DSource = newSfx2Dsource.AddComponent <AudioSource>();
            newSfx2Dsource.transform.parent = transform;

            audioListener = FindObjectOfType <AudioListener>().transform;

            AudioSetting audioSetting = new AudioSetting();
            audioSetting.Load();
            masterVolumePercent = audioSetting.masterVolumePercent;
            musicVolumePercent  = audioSetting.musicVolumePercent;
            sfxVolumePercent    = audioSetting.sfxVolumePercent;
        }
    }
Exemplo n.º 3
0
 public void Load()
 {
     audioSetting.Load();
 }