// Update is called once per frame public void Update() { /* if (this.introMovie.isPlaying && !Input.anyKeyDown) * return; * this.introMovie.Stop();*/ startedTime = startedTime - Time.deltaTime; switch (status) { case fadeStatus.started: if (startedTime <= 0) { status = fadeStatus.fadeIn; } break; case fadeStatus.fadeIn: alpha += fadeSpeed * Time.deltaTime; break; case fadeStatus.fadeWaiting: if ((!waitForInput && Time.time >= timeFadingToFinish + waitTime) || (waitForInput && Input.anyKey)) { status = fadeStatus.fadeOut; } break; case fadeStatus.fadeOut: alpha += -fadeSpeed * Time.deltaTime; break; } // MkAdministrator.loadScene("01-MainMenu"); }
void SetAlpha() { if (fadeNow == fadeStatus.none) { return; //fadeしていないのになんで来たんだ } else if (fadeNow == fadeStatus.fadein) //フェードインなら { colorNow = Color.Lerp(startColor, maxColor, TimeRate()); if (TimeRate() > 1f) { fadeNow = fadeStatus.none; } } else if (fadeNow == fadeStatus.fadeout) //フェードアウトなら { colorNow = Color.Lerp(startColor, clearColor, TimeRate()); if (TimeRate() >= 1f) //fadeOut終了なら寝かせる { appearObj.SetActive(false); fadeNow = fadeStatus.none; } } objectMaterial.color = colorNow; }
//切り替え時の状態ジャッジ&処理Class void Judge() { if (!isActive) //元々寝ていた場合->起こす { isActive = true; appearObj.SetActive(true); fadeNow = fadeStatus.fadein; } else //起きていた場合 { isActive = false; //fade終了まで実際のActiveは消さない fadeNow = fadeStatus.fadeout; } }
public void OnGUI() { /*float height = (float)((double)Screen.width / 4.0 * 3.0); * float top = (float)((double)Screen.height * 0.5 - (double)height * 0.5); * GUI.Label(new Rect(0.0f, 0.0f, (float)Screen.width, (float)Screen.height), string.Empty, this.introMovieStyle); * GUI.Label(new Rect(0.0f, top, (float)Screen.width, height), (Texture)this.introMovie, this.introMovieStyle);*/ GUI.depth = guiDepth; if (splashScreen1 != null) { GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, Mathf.Clamp01(alpha)); GUI.DrawTexture(splashLogoPos, splashScreen2[bildNummer]); if (alpha > 1.0f) { status = fadeStatus.fadeWaiting; timeFadingToFinish = Time.time; alpha = 1.0f; if (SplashType == splashType.loadNextLevelThenFadeOut) { loadingNextLevel = true; { if ((Application.levelCount >= 1) && (levelToLoad != "")) { Application.LoadLevel(levelToLoad); } } } } if (alpha < 0.0f) { if (SplashType == splashType.fadeOutThenLoadNextLevel) { loadingNextLevel = true; { if ((Application.levelCount >= 1) && (levelToLoad != "")) { Application.LoadLevel(levelToLoad); } } } else { Destroy(this); } } } }
// Use this for initialization protected void OriginStart() { isActive = IsReverse; //初期状態の設定 appearObj.SetActive(isActive); objectMaterial = appearObj.GetComponent <Renderer>().material; #region Fade関連の数値の設定 startColor = objectMaterial.color; //現在色取得 maxColor = startColor; //a=maxの状態を保存 clearColor = startColor; clearColor.a = 0f; //a=0も作成 //Init時の色は反転設定=trueなら出現しているのでmax, falseなら消えているのでclear colorNow = IsReverse ? maxColor : clearColor; fadeNow = fadeStatus.none; //ステータスは変化なし #endregion }
// LOGO POSITION ENDE -------------- // // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // Use this for initialization void Start() { // this.introMovie.Play(); if (startAutomatic) { status = fadeStatus.started; } else { status = fadeStatus.paused; } if (LogoPositioning == logoPositioning.center) { splashLogoPos.x = (Screen.width * 0.5f) - (splashScreen1.width * 0.5f); splashLogoPos.y = (Screen.height * 0.5f) - (splashScreen1.height * 0.5f); splashLogoPos.width = splashScreen1.width; splashLogoPos.height = splashScreen1.height; } else { splashLogoPos.x = 0; splashLogoPos.y = 0; splashLogoPos.width = Screen.width; splashLogoPos.height = Screen.height; } if (SplashType == splashType.loadNextLevelThenFadeOut) { DontDestroyOnLoad(this); } if ((Application.levelCount <= 1) || (levelToLoad == "")) { Debug.LogWarning("Invalid levelToLoad value."); } bildNummer = 0; }
public void startSplash() { status = fadeStatus.fadeIn; }