public void Shake(ScreenShakeProperties properties) { this._noiseModule.m_NoiseProfile = properties.noiseProfile; this._noiseModule.m_AmplitudeGain = properties.amplitudeGain; this._noiseModule.m_FrequencyGain = properties.frequencyGain; //this.StartCoroutine(this.Animate(properties)); this.Invoke("ResetNoise", properties.time); }
private IEnumerator Animate(ScreenShakeProperties properties) { Debug.Log("Screen shaking with amplitude gain: " + properties.amplitudeGain + " & frequency gain: " + properties.frequencyGain + " for " + properties.time + " seconds."); float elapsedTime = 0.0f; //this._mainCamera.GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>().m_NoiseProfile = properties.noiseProfile; this._noiseModule.m_AmplitudeGain = properties.amplitudeGain; this._noiseModule.m_FrequencyGain = properties.frequencyGain; while (elapsedTime <= properties.time) { if (GameConstants.paused) { yield return(null); continue; } elapsedTime += Time.deltaTime; } this.ResetNoise(); yield break; }