void SlowMotion() { if (!isSlomo) { isSlomo = true; audioMixer.DOKill(); audioMixer.DOSetFloat("LowpassFrequency", 3000f, 0.15f); soundsManager.PlaySound("SlowMotion"); } Time.timeScale = Mathf.Lerp(Time.timeScale, slomoValue, slomoLerp); Time.fixedDeltaTime = 0.02F * Time.timeScale; if (GetComponent <BoxCollider2D>().enabled == true) { GetComponent <BoxCollider2D>().enabled = false; } if (!dottedLine.activeSelf) { dottedLine.SetActive(true); } //DottedLineRotation var pos = Camera.main.WorldToScreenPoint(transform.position); var dir = Input.mousePosition - pos; var angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; dottedLine.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward); //CameraEffects if (saturationEffect.enabled == false) { saturationEffect.enabled = true; } saturationEffect.Boost = Mathf.Lerp(saturationEffect.Boost, 0.3f, slomoLerp); if (vignette.enabled == false) { vignette.enabled = true; } if (constrastVignette.enabled == false) { constrastVignette.enabled = true; } constrastVignette.Darkness = Mathf.Lerp(constrastVignette.Darkness, 30f, slomoLerp); camera.orthographicSize = Mathf.Lerp(camera.orthographicSize, 14.5f, slomoLerp); }
public void SetMusic(float volume, bool fast) { mixer.DOKill(); if (fast) { mixer.SetFloat("MusicVol", volume); } else { mixer.DOSetFloat("MusicVol", volume, 1).SetUpdate(true); } }