// Use this for initialization void Start() { player = GameObject.FindWithTag("Player").gameObject; BGMBox.SetActive(false); mixer.SetFloat("BGM2Volume", 0); //UIたちの初期化 level = levelUI.GetComponent <Text> (); score = scoreUI.GetComponent <Text> (); resultScore = resultScoreUI.GetComponent <Text> (); highScore = highScoreUI.GetComponent <Text> (); resultUI.SetActive(false); Enums.Level = 0; Enums.Score = 0; //敵を生成 for (int i = 0; i < enemys.Length; i++) { enemys [i] = Instantiate(enemy) as GameObject; enemys [i].transform.parent = transform; enemys [i].SetActive(false); } //HP回復玉を生成 HPBall = Instantiate(healHP) as GameObject; HPBall.transform.parent = transform; HPBall.SetActive(false); StartCoroutine(isEnemy()); }
void Start() { if (!PlayerPrefs.HasKey("Volume")) { PlayerPrefs.SetInt("Volume", 100); PlayerPrefs.Save(); } volumeSetting.value = PlayerPrefs.GetInt("Volume"); PlayerData.Create(); if (PlayerData.instance.masterVolume > float.MinValue) { mixer.SetFloat("MasterVolume", PlayerData.instance.masterVolume); mixer.SetFloat("MusicVolume", PlayerData.instance.musicVolume); mixer.SetFloat("MasterSFXVolume", PlayerData.instance.masterSFXVolume); } else { mixer.GetFloat("MasterVolume", out PlayerData.instance.masterVolume); mixer.GetFloat("MusicVolume", out PlayerData.instance.musicVolume); mixer.GetFloat("MasterSFXVolume", out PlayerData.instance.masterSFXVolume); PlayerData.instance.Save(); } StartCoroutine(RestartAllStems()); }
private void Update() { mixer.SetFloat(paramNames[(int)Param.Master], masterVolume); mixer.SetFloat(paramNames[(int)Param.UI], uiVolume); mixer.SetFloat(paramNames[(int)Param.BGM], bgmVolume); mixer.SetFloat(paramNames[(int)Param.SE], seVolume); }
void tyousei() { if (Input.GetKeyDown(KeyCode.LeftArrow)) { switch (num) { case 0: if (vol_num != 0) { vol_num--; PlayerPrefs.SetInt("vol", vol_num); mixer.SetFloat("BGM", Mathf.Lerp(-80, 0, vol_num * 20 / 100f)); volposi.localPosition = startvol + new Vector3((PlayerPrefs.GetInt("vol", 1) - 3) * 110, 0, 0); } break; case 1: if (se_num != 0) { se_num--; PlayerPrefs.SetInt("se", se_num); mixer.SetFloat("SE", Mathf.Lerp(-80, 0, se_num * 20 / 100f)); seposi.localPosition = startse + new Vector3((PlayerPrefs.GetInt("se", 1) - 3) * 110, 0, 0); } break; default: break; } } if (Input.GetKeyDown(KeyCode.RightArrow)) { switch (num) { case 0: if (vol_num != 5) { vol_num++; PlayerPrefs.SetInt("vol", vol_num); mixer.SetFloat("BGM", Mathf.Lerp(-80, 0, vol_num * 20 / 100f)); volposi.localPosition = startvol + new Vector3((PlayerPrefs.GetInt("vol", 1) - 3) * 110, 0, 0); } break; case 1: if (se_num != 5) { se_num++; PlayerPrefs.SetInt("se", se_num); mixer.SetFloat("SE", Mathf.Lerp(-80, 0, se_num * 20 / 100f)); seposi.localPosition = startse + new Vector3((PlayerPrefs.GetInt("se", 1) - 3) * 110, 0, 0); } break; default: break; } } }
void SetMixerVolume(float mainVolume, float ambientVolume) { //print("Volume: " + mainVolume + " , " + ambientVolume); if (masterMixer != null) { masterMixer.SetFloat("MainVolume", mainVolume); masterMixer.SetFloat("AmbientVolume", ambientVolume); } }
void Start() { // スタートより早くセットすると何者かに上書きされます。死ね mixer.SetFloat(Defines.KEY_SOUND_BGM, Mathf.Lerp(Defines.SOUND_VOLME_MIN, Defines.SOUND_VOLUME_MAX, user_data.ReadFloat(Defines.KEY_SOUND_BGM))); mixer.SetFloat(Defines.KEY_SOUND_SE, Mathf.Lerp(Defines.SOUND_VOLME_MIN, Defines.SOUND_VOLUME_MAX, user_data.ReadFloat(Defines.KEY_SOUND_SE))); // タイムスケールで倍速対応できるのありがたい Time.timeScale = 1.0f; }
// Use this for initialization void Start() { if (SceneManager.GetActiveScene( ).name == "title" || (SceneManager.GetActiveScene( ).name == "select" && !GameObject.Find("BGM_Title(Clone)"))) { Instantiate(BGM_title); mixer.SetFloat("BGM_Volume", 0); mixer.SetFloat("SE_Volume", 0); } }
void SetMixer() { print("PlayerPrefs.GetFloat(Master_V)" + PlayerPrefs.GetFloat("Master_V")); mg.SetFloat("Master", -80 + SoundVolume[0] * 10); PlayerPrefs.SetFloat("Master_V", -80 + SoundVolume[0] * 10); mg.SetFloat("BG", -80 + SoundVolume[1] * 10); PlayerPrefs.SetFloat("BG_V", -80 + SoundVolume[1] * 10); mg.SetFloat("Objects", -80 + SoundVolume[2] * 10); PlayerPrefs.SetFloat("Objects_V", -80 + SoundVolume[2] * 10); }
private void Start() { mix.SetFloat("MasterVol", PlayerPrefs.GetFloat("MasterVol")); Slider[0].value = PlayerPrefs.GetFloat("MasterVol"); mix.SetFloat("MusicVol", PlayerPrefs.GetFloat("MusicVol")); Slider[1].value = PlayerPrefs.GetFloat("MusicVol"); mix.SetFloat("SFXVol", PlayerPrefs.GetFloat("SFXVol")); Slider[2].value = PlayerPrefs.GetFloat("SFXVol"); mix.SetFloat("AmbienceVol", PlayerPrefs.GetFloat("AmbienceVol")); Slider[3].value = PlayerPrefs.GetFloat("AmbienceVol"); }
void Start() { //Debug.Log("start"); // こっちで間に合うというかこのタイミングじゃないとボリューム調整が効かない //mixer.SetFloat("BGM", user_data.ReadFloat(Defines.KEY_SOUNDVOLUME_BGM)); //mixer.SetFloat("SE", user_data.ReadFloat(Defines.KEY_SOUNDVOLUME_SE)); // スタートより早くセットすると何者かに上書きされます。死ね mixer.SetFloat("BGM", Mathf.Lerp(Defines.SOUND_VOLME_MIN, Defines.SOUND_VOLUME_MAX, user_data.ReadFloat(Defines.KEY_SOUNDVOLUME_BGM))); mixer.SetFloat("SE", Mathf.Lerp(Defines.SOUND_VOLME_MIN, Defines.SOUND_VOLUME_MAX, user_data.ReadFloat(Defines.KEY_SOUNDVOLUME_SE))); BGMControl.Instance.Play(); }
// override protected void FixedUpdate () // { // base.FixedUpdate (); // } override protected void ButtonFunction() { if (!isMute) { isMute = true; mixer.SetFloat("Master", -80f); buttonImage.sprite = muteSprite; Debug.Log("OK"); } else { isMute = false; mixer.SetFloat("Master", initialVolume); buttonImage.sprite = defaultSprite; } }
static public int SetFloat(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.Audio.AudioMixer self = (UnityEngine.Audio.AudioMixer)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); var ret = self.SetFloat(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public void MuteMusic() { float volume; mixer.GetFloat("MusicVolume", out volume); if (volume < -70) { NoMusic.gameObject.SetActive(false); mixer.SetFloat("MusicVolume", 0); } else { NoMusic.gameObject.SetActive(true); mixer.SetFloat("MusicVolume", -80); } }
void Start() { HighScoreLable.text = "HighScore : " + (PlayerPrefs.GetInt("HighScore", 0)).ToString() + "m"; var Bgm = PlayerPrefs.GetFloat("BGMVolume", 0); var Se = PlayerPrefs.GetFloat("SEVolume", 0); BGM.SetFloat("BGMVolume", Bgm); SE.SetFloat("BGMVolume", Se); }
// Use this for initialization void Start() { mixer.SetFloat("BGMVolumn", -20.0f); float theVolumn; mixer.GetFloat("BGMVolumn", out theVolumn); Debug.Log(">>>>>>>>" + theVolumn); }
void Start() { PlayerData.Create(); if (PlayerData.instance.masterVolume > float.MinValue) { mixer.SetFloat("MasterVolume", PlayerData.instance.masterVolume); mixer.SetFloat("MusicVolume", PlayerData.instance.musicVolume); mixer.SetFloat("MasterSFXVolume", PlayerData.instance.masterSFXVolume); } else { mixer.GetFloat("MasterVolume", out PlayerData.instance.masterVolume); mixer.GetFloat("MusicVolume", out PlayerData.instance.musicVolume); mixer.GetFloat("MasterSFXVolume", out PlayerData.instance.masterSFXVolume); } StartCoroutine(RestartAllStems()); }
void SetupAudioMixer() { if (p_mixer) { if (PlayerPrefs.HasKey(Slime_Const.Volume_Master)) { tmp = PlayerPrefs.GetFloat(Slime_Const.Volume_Master); p_mixer.SetFloat(Slime_Const.Volume_Master, tmp); } if (PlayerPrefs.HasKey(Slime_Const.Volume_Music)) { tmp = PlayerPrefs.GetFloat(Slime_Const.Volume_Music); p_mixer.SetFloat(Slime_Const.Volume_Music, tmp); } if (PlayerPrefs.HasKey(Slime_Const.Volume_Sfx)) { tmp = PlayerPrefs.GetFloat(Slime_Const.Volume_Sfx); p_mixer.SetFloat(Slime_Const.Volume_Sfx, tmp); } } }
void Start() { float sfxvolume = PlayerPrefs.GetFloat("sfxVolume", .5f); float musicvolume = PlayerPrefs.GetFloat("musicVolume", 1f); if (musicvolume != 0) { audioMixer.SetFloat("musicVolume", Mathf.Log10(musicvolume) * 20); } else { audioMixer.SetFloat("musicVolume", -80); } if (sfxvolume != 0) { audioMixer.SetFloat("sfxVolume", Mathf.Log10(sfxvolume) * 20); } else { audioMixer.SetFloat("sfxVolume", -80); } SetupFeaturedGames(); Cursor.visible = true; Cursor.lockState = CursorLockMode.None; if (debugShortcutToMpJoin) { menuPanelManager.OpenMultiplayerMenu(); debugShortcutToMpJoin = false; } resuming.QueryResumeInfo(this); }
// Start is called before the first frame update void Start() { soundVolume.value = PlayerPrefs.GetFloat("SoundVolume", 1); mixer.SetFloat("SoundVolume", Mathf.Log10(soundVolume.value) * 20); musicVolume.value = PlayerPrefs.GetFloat("SoundVolume", 1); mixer.SetFloat("SoundVolume", Mathf.Log10(musicVolume.value) * 20); invertY.isOn = (PlayerPrefs.GetInt("InvertedY", -1) == -1? true : false); invertX.isOn = (PlayerPrefs.GetInt("InvertedX", 1) == 1 ? true : false); easyDash.isOn = (PlayerPrefs.GetInt("EasyDash", 0) == 1 ? true : false); }
static public int SetFloat(IntPtr l) { try { UnityEngine.Audio.AudioMixer self = (UnityEngine.Audio.AudioMixer)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); self.SetFloat(a1, a2); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static int SetFloat(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); UnityEngine.Audio.AudioMixer obj = (UnityEngine.Audio.AudioMixer)ToLua.CheckObject <UnityEngine.Audio.AudioMixer>(L, 1); string arg0 = ToLua.CheckString(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); bool o = obj.SetFloat(arg0, arg1); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int SetFloat(IntPtr l) { try { UnityEngine.Audio.AudioMixer self = (UnityEngine.Audio.AudioMixer)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); var ret = self.SetFloat(a1, a2); pushValue(l, ret); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
// Start is called before the first frame update void OnEnable() { mixer = output.audioMixer; if (PlayerPrefs.HasKey(output.name)) { startVol = PlayerPrefs.GetFloat(output.name); mixer.SetFloat(output.name, startVol); } else { mixer.GetFloat(output.name, out startVol); } slider.minValue = 0; slider.maxValue = 100; slider.value = startVol + 80; }
void run(string cmd) { GamePad.reset(); switch (cmd) { default: break; case "Resume": Game.SetActive(true); gameObject.SetActive(false); break; case "Sound": Volume -= 2; if (Volume < -8) { Volume = 0; } Mixer.SetFloat("Vol", Volume * 10); GetComponent <AudioSource>().Play(); break; case "Restart": Game.SetActive(true); gameObject.SetActive(false); Ship.Life = 0; Game.SetActive(false); Cursor = 0; break; case "Quit": #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #endif Application.Quit(); print("Quit"); break; } }
private void MuteSound(AudioMixer audiosource, string valueName) { audiosource.SetFloat (valueName, -80); }
void SetVolume(float _value) { mixer.SetFloat(parameterName, ConvertToDecibel(_value / slider.maxValue)); PlayerPrefs.SetFloat(parameterName, _value); }
void UpdatePitch() { mixer.SetFloat("PitchShifter", pitch); }
public void SetVolume(float _fRate) { mixer.SetFloat(group_name, Mathf.Lerp(Defines.SOUND_VOLME_MIN, Defines.SOUND_VOLUME_MAX, _fRate)); }
private void AjusterVolume(AudioMixer audioSource, string valueName, Slider curseur, int valeurMin = -24, int valeurMax = 0) { audioSource.SetFloat (valueName, _StaticFunction.MappingScale(curseur.value, curseur.minValue, curseur.maxValue, valeurMin, valeurMax)); }
void MasterVolume() { mixer.SetFloat("MasterVolume", Mathf.Lerp(-80, 0, MasterValue)); }
/****** Volume ******/ void Mixer_Set_Float(AudioMixer Mixer, string param, float value){ //float volume = Mathf.Clamp(value, 0.0001f, 1.0f); //float volumeDB = 20f * Mathf.Log10(volume); //Mixer.SetFloat (param, Mathf.Clamp(volumeDB, -80.0f, 0.0f)); Mixer.SetFloat (param, Mathf.Lerp(MIXER_MIN_VOLUME, MIXER_MAX_VOLUME, value)); }
void SetVolume(float _value) { Volume.SetFloat(parameterName, ConvertToDecibel(_value / slider.maxValue)); //Dividing by max allows arbitrary positive slider maxValue PlayerPrefs.SetFloat(parameterName, _value); }
/// <summary> /// SEの大きさを設定 /// </summary> public void SEVolume(float vol) { mixer.SetFloat("SE", vol); }
public static void SetVolume( AudioMixer mixer, string nameVolume, float valueVolume) { mixer.SetFloat (nameVolume, valueVolume); }