// Update is called once per frame void Update () { if (actualQuality != QualitySettings.GetQualityLevel()) qualityChanges(); if (Camera.current != null && Camera.current == Camera.main) { //float ratioValue = (-0.0028f * Camera.current.transform.position.z) + 0.0089f; float ratioValue = (-0.0028f * Camera.current.transform.position.z) + 0.0111f; ratioValue *= 100f; ratioValue = Mathf.Floor(ratioValue); ratioValue /= 100f; if (ratioValue < 0.05f) ratioValue = 0.05f; if (occlusion.m_Radius != ratioValue) occlusion.m_Radius = ratioValue; } switch(phase) { case noisephase.GROW: if (noiseAndGrain.intensityMultiplier < 1.25f) noiseAndGrain.intensityMultiplier += 0.5f * Time.deltaTime; else { nextPhase = Time.time + Random.Range(1.0f, 5.0f); phase = noisephase.WAIT_UP; } break; case noisephase.WAIT_UP: if (Time.time >= nextPhase) phase = noisephase.NARROW; break; case noisephase.NARROW: float value = noiseAndGrain.intensityMultiplier - (0.5f * Time.deltaTime); if (value > 0) noiseAndGrain.intensityMultiplier = value; else { nextPhase = Time.time + Random.Range(2.0f, 10.0f); phase = noisephase.WAIT_DOWN; } break; case noisephase.WAIT_DOWN: if (Time.time >= nextPhase) phase = noisephase.GROW; break; } }
// Update is called once per frame void Update() { if (actualQuality != QualitySettings.GetQualityLevel()) { qualityChanges(); } if (Camera.current != null && Camera.current == Camera.main) { //float ratioValue = (-0.0028f * Camera.current.transform.position.z) + 0.0089f; float ratioValue = (-0.0028f * Camera.current.transform.position.z) + 0.0111f; ratioValue *= 100f; ratioValue = Mathf.Floor(ratioValue); ratioValue /= 100f; if (ratioValue < 0.05f) { ratioValue = 0.05f; } if (occlusion.m_Radius != ratioValue) { occlusion.m_Radius = ratioValue; } } switch (phase) { case noisephase.GROW: if (noiseAndGrain.intensityMultiplier < 1.25f) { noiseAndGrain.intensityMultiplier += 0.5f * Time.deltaTime; } else { nextPhase = Time.time + Random.Range(1.0f, 5.0f); phase = noisephase.WAIT_UP; } break; case noisephase.WAIT_UP: if (Time.time >= nextPhase) { phase = noisephase.NARROW; } break; case noisephase.NARROW: float value = noiseAndGrain.intensityMultiplier - (0.5f * Time.deltaTime); if (value > 0) { noiseAndGrain.intensityMultiplier = value; } else { nextPhase = Time.time + Random.Range(2.0f, 10.0f); phase = noisephase.WAIT_DOWN; } break; case noisephase.WAIT_DOWN: if (Time.time >= nextPhase) { phase = noisephase.GROW; } break; } }