void OnCollisionEnter(Collision col) { ParticleMan.Emit(0, Random.Range(2, 6), transform.position, col.contacts[0].normal); ParticleMan.Emit(2, Random.Range(1, 4), transform.position, (GetComponent <Rigidbody>().velocity.normalized * .5f + col.contacts[0].normal)); if (col.transform.CompareTag("Destructable")) { _rb.velocity = _oldVelocity * .9f; col.gameObject.GetComponent <DestructableBehaviour>().TakeDamage(col.relativeVelocity.magnitude, col); StartCoroutine(Die()); } else { StartCoroutine(Die()); _lr.widthMultiplier = _lr.widthMultiplier * .7f; if (_canDoyng) { _canDoyng = false; if (col.transform.CompareTag("Statue")) { AudioMan.PlaySound(SoundName.BulletImapct, transform.position); } else { AudioMan.PlaySound(SoundName.Ricochet, transform.position); } } } }
// Token: 0x06000602 RID: 1538 RVA: 0x000332A4 File Offset: 0x000314A4 private void Update() { if (this.m_bindDialog.activeSelf) { this.UpdateBinding(); return; } this.UpdateResSwitch(Time.deltaTime); AudioListener.volume = this.m_volumeSlider.value; MusicMan.m_masterMusicVolume = this.m_musicVolumeSlider.value; AudioMan.SetSFXVolume(this.m_sfxVolumeSlider.value); this.SetQualityText(this.m_shadowQualityText, (int)this.m_shadowQuality.value); this.SetQualityText(this.m_lodText, (int)this.m_lod.value); this.SetQualityText(this.m_lightsText, (int)this.m_lights.value); this.SetQualityText(this.m_vegetationText, (int)this.m_vegetation.value); this.m_resButtonText.text = string.Concat(new object[] { this.m_selectedRes.width, "x", this.m_selectedRes.height, " ", this.m_selectedRes.refreshRate, "hz" }); this.m_guiScaleText.text = this.m_guiScaleSlider.value.ToString() + "%"; GuiScaler.SetScale(this.m_guiScaleSlider.value / 100f); if (Input.GetKeyDown(KeyCode.Escape)) { this.OnBack(); } }
// Token: 0x0600060A RID: 1546 RVA: 0x00033990 File Offset: 0x00031B90 private void LoadSettings() { ZInput.instance.Load(); AudioListener.volume = PlayerPrefs.GetFloat("MasterVolume", AudioListener.volume); MusicMan.m_masterMusicVolume = PlayerPrefs.GetFloat("MusicVolume", 1f); AudioMan.SetSFXVolume(PlayerPrefs.GetFloat("SfxVolume", 1f)); this.m_continousMusic.isOn = (PlayerPrefs.GetInt("ContinousMusic", 1) == 1); PlayerController.m_mouseSens = PlayerPrefs.GetFloat("MouseSensitivity", PlayerController.m_mouseSens); PlayerController.m_invertMouse = (PlayerPrefs.GetInt("InvertMouse", 0) == 1); float @float = PlayerPrefs.GetFloat("GuiScale", 1f); this.m_volumeSlider.value = AudioListener.volume; this.m_sensitivitySlider.value = PlayerController.m_mouseSens; this.m_sfxVolumeSlider.value = AudioMan.GetSFXVolume(); this.m_musicVolumeSlider.value = MusicMan.m_masterMusicVolume; this.m_guiScaleSlider.value = @float * 100f; this.m_invertMouse.isOn = PlayerController.m_invertMouse; this.m_gamepadEnabled.isOn = ZInput.IsGamepadEnabled(); this.m_languageKey = Localization.instance.GetSelectedLanguage(); this.m_language.text = Localization.instance.Localize("$language_" + this.m_languageKey.ToLower()); this.m_cameraShake.isOn = (PlayerPrefs.GetInt("CameraShake", 1) == 1); this.m_shipCameraTilt.isOn = (PlayerPrefs.GetInt("ShipCameraTilt", 1) == 1); this.m_quickPieceSelect.isOn = (PlayerPrefs.GetInt("QuickPieceSelect", 0) == 1); this.m_showKeyHints.isOn = (PlayerPrefs.GetInt("KeyHints", 1) == 1); this.m_dofToggle.isOn = (PlayerPrefs.GetInt("DOF", 1) == 1); this.m_vsyncToggle.isOn = (PlayerPrefs.GetInt("VSync", 0) == 1); this.m_bloomToggle.isOn = (PlayerPrefs.GetInt("Bloom", 1) == 1); this.m_ssaoToggle.isOn = (PlayerPrefs.GetInt("SSAO", 1) == 1); this.m_sunshaftsToggle.isOn = (PlayerPrefs.GetInt("SunShafts", 1) == 1); this.m_aaToggle.isOn = (PlayerPrefs.GetInt("AntiAliasing", 1) == 1); this.m_caToggle.isOn = (PlayerPrefs.GetInt("ChromaticAberration", 1) == 1); this.m_motionblurToggle.isOn = (PlayerPrefs.GetInt("MotionBlur", 1) == 1); this.m_softPartToggle.isOn = (PlayerPrefs.GetInt("SoftPart", 1) == 1); this.m_tesselationToggle.isOn = (PlayerPrefs.GetInt("Tesselation", 1) == 1); this.m_shadowQuality.value = (float)PlayerPrefs.GetInt("ShadowQuality", 2); this.m_lod.value = (float)PlayerPrefs.GetInt("LodBias", 2); this.m_lights.value = (float)PlayerPrefs.GetInt("Lights", 2); this.m_vegetation.value = (float)PlayerPrefs.GetInt("ClutterQuality", 2); this.m_fullscreenToggle.isOn = Screen.fullScreen; this.m_oldFullscreen = this.m_fullscreenToggle.isOn; this.m_oldRes = Screen.currentResolution; this.m_oldRes.width = Screen.width; this.m_oldRes.height = Screen.height; this.m_selectedRes = this.m_oldRes; ZLog.Log(string.Concat(new object[] { "Current res ", Screen.currentResolution.width, "x", Screen.currentResolution.height, " ", Screen.width, "x", Screen.height })); }
private void Awake() { if (manager == null) { manager = this; } else if (manager != this) { Destroy(gameObject); } }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
// Token: 0x060009F2 RID: 2546 RVA: 0x00047F50 File Offset: 0x00046150 private void Awake() { if (AudioMan.m_instance != null) { ZLog.Log("Audioman already exist, destroying self"); UnityEngine.Object.DestroyImmediate(base.gameObject); return; } AudioMan.m_instance = this; UnityEngine.Object.DontDestroyOnLoad(base.gameObject); GameObject gameObject = new GameObject("ocean_ambient_loop"); gameObject.transform.SetParent(base.transform); this.m_oceanAmbientSource = gameObject.AddComponent <AudioSource>(); this.m_oceanAmbientSource.loop = true; this.m_oceanAmbientSource.spatialBlend = 0.75f; this.m_oceanAmbientSource.outputAudioMixerGroup = this.m_ambientMixer; this.m_oceanAmbientSource.maxDistance = 128f; this.m_oceanAmbientSource.minDistance = 40f; this.m_oceanAmbientSource.spread = 90f; this.m_oceanAmbientSource.rolloffMode = AudioRolloffMode.Linear; this.m_oceanAmbientSource.clip = this.m_oceanAudio; this.m_oceanAmbientSource.bypassReverbZones = true; this.m_oceanAmbientSource.dopplerLevel = 0f; this.m_oceanAmbientSource.volume = 0f; this.m_oceanAmbientSource.Play(); GameObject gameObject2 = new GameObject("ambient_loop"); gameObject2.transform.SetParent(base.transform); this.m_ambientLoopSource = gameObject2.AddComponent <AudioSource>(); this.m_ambientLoopSource.loop = true; this.m_ambientLoopSource.spatialBlend = 0f; this.m_ambientLoopSource.outputAudioMixerGroup = this.m_ambientMixer; this.m_ambientLoopSource.bypassReverbZones = true; this.m_ambientLoopSource.volume = 0f; GameObject gameObject3 = new GameObject("wind_loop"); gameObject3.transform.SetParent(base.transform); this.m_windLoopSource = gameObject3.AddComponent <AudioSource>(); this.m_windLoopSource.loop = true; this.m_windLoopSource.spatialBlend = 0f; this.m_windLoopSource.outputAudioMixerGroup = this.m_ambientMixer; this.m_windLoopSource.bypassReverbZones = true; this.m_windLoopSource.clip = this.m_windAudio; this.m_windLoopSource.volume = 0f; this.m_windLoopSource.Play(); if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null) { AudioListener.volume = 0f; return; } AudioListener.volume = PlayerPrefs.GetFloat("MasterVolume", AudioListener.volume); AudioMan.SetSFXVolume(PlayerPrefs.GetFloat("SfxVolume", AudioMan.GetSFXVolume())); }
void OnCollisionEnter(Collision col) { if (col.transform.CompareTag("Bullet") || col.impulse.magnitude > BreakForce) { if (col.contacts[0].thisCollider.gameObject.name != name) { GetNearest(col.contacts[0].point, col.impulse.magnitude, col.transform.CompareTag("Bullet") ? 8 : 1); ParticleMan.Emit(3, 5, col.contacts[0].point, Vector3.up); AudioMan.PlaySound(SoundName.StoneCrunch, col.contacts[0].point); } } }
public void PullTrigger() { GameObject bullet = Instantiate(BulletPrefab); AudioMan.PlaySound(SoundName.GunFired); bullet.transform.position = FunPoint.position; bullet.GetComponent <Rigidbody>().velocity = FunPoint.forward * BulletSpeed; transform.localPosition -= Vector3.forward * recoil.z; transform.Rotate(Vector3.right, recoil.x); MakeParticleLine(); StartCoroutine(FlashGun()); }
private void Awake() { //levelMusic = GameObject.FindGameObjectWithTag("m_Level").GetComponent<AudioSource>(); //sfxSource = GameObject.FindGameObjectWithTag("sfx").GetComponent<AudioSource>(); if (a_Instance == null) { a_Instance = this; } else if (a_Instance != this) { Destroy(a_Instance); } }
private void Awake() { if (inst != null) { Destroy(this.gameObject); } else { inst = this; } DontDestroyOnLoad(this.gameObject); }
private void Awake() { //Check if instance exists if (instance == null) { //If not, assign this to it. instance = this; } else if (instance != this) { //If so (somehow), destroy this object. Destroy(gameObject); } DontDestroyOnLoad(audioSrc); }
public static void Prefix(Player __instance) { if (CustomInput.GetKeyDown("ToggleAllRewards")) { new Thread(() => { Plugin.Instance.ToggleRewards(!Plugin.Instance.isRewardsEnabled); }).Start(); } if (!Plugin.Instance.isInGame || !CustomInput.GetKeyDown("Whistle")) { return; } PlayerLoadPatch.Whistle(AudioMan.GetSFXVolume()); foreach (var character in CharacterAwakePatch.tamedCharacters) { var znview = character.GetComponent <ZNetView>(); if (znview == null) { continue; } var zdo = znview.GetZDO(); if (zdo == null) { continue; } var customName = zdo.GetString($"{Plugin.GUID}-name"); if (customName.Length == 0) { return; } var ai = character.GetComponent <MonsterAI>(); ai.SetFollowTarget(__instance.gameObject); } }
static void Postfix(AudioMan __instance, List <AudioMan.BiomeAmbients> ___m_randomAmbients, AudioSource ___m_oceanAmbientSource, AudioSource ___m_windLoopSource) { List <string> dump = new List <string>(); for (int i = 0; i < ___m_randomAmbients.Count; i++) { dump.Add($"Ambient list name: {___m_randomAmbients[i].m_name}"); dump.Add($"\tAmbient tracks: (use {___m_randomAmbients[i].m_name})"); for (int j = 0; j < ___m_randomAmbients[i].m_randomAmbientClips.Count; j++) { dump.Add($"\t\ttrack name: {___m_randomAmbients[i].m_randomAmbientClips[j].name}"); //Dbgl($"checking ambient: { ___m_randomAmbients[i].m_name}, clip: {___m_randomAmbients[i].m_randomAmbientClips[j].name}"); if (customAmbient.ContainsKey(___m_randomAmbients[i].m_randomAmbientClips[j].name)) { Dbgl($"replacing ambient: { ___m_randomAmbients[i].m_name}, clip: {___m_randomAmbients[i].m_randomAmbientClips[j].name}"); ___m_randomAmbients[i].m_randomAmbientClips[j] = customAmbient[___m_randomAmbients[i].m_randomAmbientClips[j].name]; } } dump.Add($"\tAmbient day tracks: (use {___m_randomAmbients[i].m_name}_day)"); for (int j = 0; j < ___m_randomAmbients[i].m_randomAmbientClipsDay.Count; j++) { dump.Add($"\t\ttrack name: {___m_randomAmbients[i].m_randomAmbientClipsDay[j].name}"); //Dbgl($"checking ambient day: { ___m_randomAmbients[i].m_name}, clip: {___m_randomAmbients[i].m_randomAmbientClipsDay[j].name}"); if (customAmbient.ContainsKey(___m_randomAmbients[i].m_randomAmbientClipsDay[j].name)) { Dbgl($"replacing ambient day: { ___m_randomAmbients[i].m_name}, clip: {___m_randomAmbients[i].m_randomAmbientClipsDay[j].name}"); ___m_randomAmbients[i].m_randomAmbientClipsDay[j] = customAmbient[___m_randomAmbients[i].m_randomAmbientClipsDay[j].name]; } } dump.Add($"\tAmbient night tracks: (use {___m_randomAmbients[i].m_name}_night)"); for (int j = 0; j < ___m_randomAmbients[i].m_randomAmbientClipsNight.Count; j++) { dump.Add($"\t\ttrack name: {___m_randomAmbients[i].m_randomAmbientClipsNight[j].name}"); //Dbgl($"checking ambient night: { ___m_randomAmbients[i].m_name}, clip: {___m_randomAmbients[i].m_randomAmbientClipsNight[j].name}"); if (customAmbient.ContainsKey(___m_randomAmbients[i].m_randomAmbientClipsNight[j].name)) { Dbgl($"replacing ambient night: { ___m_randomAmbients[i].m_name}, clip: {___m_randomAmbients[i].m_randomAmbientClipsNight[j].name}"); ___m_randomAmbients[i].m_randomAmbientClipsNight[j] = customAmbient[___m_randomAmbients[i].m_randomAmbientClipsNight[j].name]; } } if (customAmbientList.ContainsKey(___m_randomAmbients[i].m_name + "_day")) { Dbgl($"replacing ambient day list by name: {___m_randomAmbients[i].m_name}"); ___m_randomAmbients[i].m_randomAmbientClipsDay = new List <AudioClip>(customAmbientList[___m_randomAmbients[i].m_name].Values.ToList()); } else if (customAmbientList.ContainsKey(___m_randomAmbients[i].m_name + "_night")) { Dbgl($"replacing ambient night list by name: {___m_randomAmbients[i].m_name}"); ___m_randomAmbients[i].m_randomAmbientClipsNight = new List <AudioClip>(customAmbientList[___m_randomAmbients[i].m_name].Values.ToList()); } else if (customAmbientList.ContainsKey(___m_randomAmbients[i].m_name)) { Dbgl($"replacing ambient list by name: {___m_randomAmbients[i].m_name}"); ___m_randomAmbients[i].m_randomAmbientClips = new List <AudioClip>(customAmbientList[___m_randomAmbients[i].m_name].Values.ToList()); } } if (dumpInfo.Value) { Dbgl(string.Join("\n", dump)); } if (customAmbient.ContainsKey("ocean")) { ___m_oceanAmbientSource.clip = customAmbient["ocean"]; } if (customAmbient.ContainsKey("wind")) { ___m_windLoopSource.clip = customAmbient["wind"]; } }
// Start is called before the first frame update void Start() { instance = this; }
//float taimer; void Start() { myAudio = AudioMan.GetComponent <AudioSource> (); }
private void Awake() { Instance = this; GameObject.DontDestroyOnLoad(this.gameObject); }