////////////////////////////////////////////////////////////////////////// void UpdateFactorDown() { this.fadeDeltaTime += Time.deltaTime; float t = this.fadeDeltaTime / (this.fadeTime); this.factor = t; if (this.factor >= 1.0f) { this.factor = 0.0f; //연출 끝 if (this.screenAnimName.Length > 0) { this.screenAnimator.speed = 0.0f; this.screenAnimator.Play(this.screenAnimName, 0, 0); } this.screenAnimator.enabled = false; this.screenRawImage.enabled = false; this.screenRawImage.texture = null; this.changeProcess = null; this.oper = null; isNowFading = false; } }
/////////////////////////////////////////////////////////////////////////////////// void UpdateColorFadeIn() { this.fadeDeltaTime += Time.deltaTime; float t = this.fadeDeltaTime / (this.fadeTime * 0.5f); this.factor = this.fadeCurve.Evaluate(t); if (this.factor >= 1.0f) { //씬바로 돌린다. if (this.oper != null) { this.oper.allowSceneActivation = true; } else { UnityEngine.SceneManagement.SceneManager.LoadScene(this.nextSceneIdx); } //ChageProcess 갱신 this.changeProcess -= UpdateColorFadeIn; this.changeProcess += new ChageProcess(UpdateColorFadeOut); } }
IEnumerator ReadyNowSceneImage() { yield return(new WaitForEndOfFrame()); //화면 크기에 맞춰. this.screenImage.Resize(Screen.width, Screen.height); this.screenImage.Apply(); //화면내용읽는다. this.screenImage.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); this.screenImage.Apply(); //Raw Image 에 물린다. this.screenRawImage.texture = this.screenImage; this.screenRawImage.enabled = true; //한 Pixel 의 UV 량 float onePixelU = 1.0f / Screen.width; float onePixelV = 1.0f / Screen.height; //Rect uvRect = this.screenRawImage.uvRect; //uvRect.x = -onePixelU * 0.5f; //uvRect.y = -onePixelV * 0.5f; //this.screenRawImage.uvRect = uvRect; //this.screenRawImage.transform.localPosition = // new Vector3(onePixelU * 0.5f, onePixelV * 0.5f, 0.0f); this.changeProcess = new ChageProcess(this.UpdateFactorDown); this.changeProcess += new ChageProcess(this.UpdateImageUpdate); this.screenAnimator.enabled = true; this.screenAnimator.speed = 0.0f; //씬바로 돌린다. if (this.oper != null) { this.oper.allowSceneActivation = true; } else { UnityEngine.SceneManagement.SceneManager.LoadScene(this.nextSceneIdx); } }
void UpdateColorFadeOut() { this.fadeDeltaTime -= Time.deltaTime; float t = this.fadeDeltaTime / (this.fadeTime * 0.5f); this.factor = this.fadeCurve.Evaluate(t); if (this.factor <= 0.0f) { //연출 끝 this.fadeImage.enabled = false; this.changeProcess = null; isNowFading = false; this.oper = null; } }
public void SceneChangeColorFade(int sceneIndex, float fadeTime, Color fadeColor) { //다음씬 기억 this.nextSceneIdx = sceneIndex; this.oper = null; //총연출시간 기억 this.fadeTime = fadeTime; this.fadeDeltaTime = 0.0f; //컬러셋팅 this.fadeImage.color = new Color(fadeColor.r, fadeColor.g, fadeColor.b, 0.0f); this.fadeImage.enabled = true; //프로세싱 함수에 Fade 연출 물린다. this.changeProcess = new ChageProcess(UpdateColorFadeImageUpdate); this.changeProcess += new ChageProcess(UpdateColorFadeIn); isNowFading = true; }