private IEnumerator FadeIn(CameraTransitionConfig cfg) { sr.sharedMaterial = cfg.fadeIn.material; pb.SetTexture(PropConsts.trueTex, cfg.fadeToTex); pb.SetTexture(PropConsts.faderTex, cfg.fadeIn.transitionTexture); SetReverse(cfg.fadeIn.material, cfg.fadeIn); Activate(); DependencyInjection.Find <ISFXService>().RequestSFX(cfg.fadeIn.sfx); for (float t = 0; t < cfg.fadeIn.time; t += ETime.ASSUME_SCREEN_FRAME_TIME) { pb.SetFloat(PropConsts.fillRatio, cfg.fadeIn.Value(t)); sr.SetPropertyBlock(pb); yield return(null); } pb.SetFloat(PropConsts.fillRatio, 1); sr.SetPropertyBlock(pb); }
private IEnumerator FadeOut(CameraTransitionConfig cfg) { sr.sharedMaterial = cfg.fadeOut.material; pb.SetTexture(PropConsts.trueTex, cfg.fadeToTex); pb.SetTexture(PropConsts.faderTex, cfg.fadeOut.transitionTexture); SetReverse(cfg.fadeOut.material, cfg.fadeOut); Activate(); for (float t = 0; t < cfg.fadeOut.time; t += ETime.ASSUME_SCREEN_FRAME_TIME) { pb.SetFloat(PropConsts.fillRatio, cfg.fadeOut.Value(t)); sr.SetPropertyBlock(pb); yield return(null); //Put this here so it works well with "long first frames" if (t == 0) { DependencyInjection.Find <ISFXService>().RequestSFX(cfg.fadeOut.sfx); } } pb.SetFloat(PropConsts.fillRatio, 0); sr.SetPropertyBlock(pb); Deactivate(); }
public static void Setup(CameraTransitionConfig dfltTransition) { defaultTransition = dfltTransition; }