using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.PostProcessing; public class MistressEffect : MonoBehaviour, IEffect { [SerializeField] float forwardSpeed = 10; [SerializeField] float backSpeed = 10; [SerializeField] float maxBloomIntensity = 7; [SerializeField] float maxVignetteIntensity = 0.6f; [SerializeField] Texture OverlayTexture; [SerializeField] Color VignetteColor; [SerializeField] PostProcessVolume volume; Bloom bloom; Vignette vignette; void Start() { volume.profile.TryGetSettings(out bloom); volume.profile.TryGetSettings(out vignette); } public void Play() { StopAllCoroutines(); StartCoroutine(MistressVictory()); } IEnumerator MistressVictory() { Color old_color = vignette.color.value; vignette.color.value = VignetteColor; yield return new WaitForSeconds(0.9f); //Ставим цвета Color color = Color.blue; bloom.color.value = color; vignette.color.value = color; bloom.dirtTexture.value = OverlayTexture; //Прямое направление float param = 0; while (param <= 1) { bloom.intensity.value = param * maxBloomIntensity; vignette.intensity.value = param * maxVignetteIntensity; param += forwardSpeed * Time.deltaTime; yield return null; } param = 1; while (param >= 0) { bloom.intensity.value = param * maxBloomIntensity; vignette.intensity.value = param * maxVignetteIntensity; param -= backSpeed * Time.deltaTime; yield return null; } bloom.intensity.value = 0; vignette.intensity.value = 0; bloom.dirtTexture.value = null; vignette.color.value = old_color; } }