コード例 #1
0
    public IEnumerator WaitForFadeIn(float fadeDelay)
    {
        if (fadeDelay >= 0)
        {
            yield return(new WaitForSeconds(fadeDelay));

            if (data.levelComplete)
            {
                StartCoroutine(WaitForFadeOut(level_endLetterFadeOutTime[data.level]));
            }
            else
            {
                StartCoroutine(WaitForFadeOut(level_startLevelFadeOutTime[data.level]));
            }
        }
        else
        {
            while (!introComplete)
            {
                yield return(new WaitForSeconds(0.1f));
            }
            StartCoroutine(WaitForFadeOut(level_startLevelFadeOutTime[data.level]));
        }
        currentFade = FadeStatus.FadeIn;
    }
コード例 #2
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            levelToLoadInt++;
            Start();
        }
        switch (status)
        {
        case FadeStatus.FadeIn:

            alpha += fadeSpeed * Time.deltaTime;
            break;

        case FadeStatus.FadeWaiting:
            if ((!waitForInput && Time.time >= timeFadingInFinished + waitTime) || (waitForInput && Input.anyKey))
            {
                status = FadeStatus.FadeOut;
            }
            break;

        case FadeStatus.FadeOut:
            alpha += -fadeSpeed * Time.deltaTime * 2;
            if (alpha <= 0.0f)
            {
                if (trigger != null)
                {
                    trigger();
                }

                status = FadeStatus.Paused;
            }
            break;
        }
    }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        switch (this.fade)
        {
        case FadeStatus.FadeOut:
            this.value += Time.deltaTime;
            if (value >= 1)
            {
                this.fade  = FadeStatus.Normal;
                this.value = 1.0f;
            }
            break;

        case FadeStatus.FadeIn:
            this.value -= Time.deltaTime;
            if (value <= 0)
            {
                this.value = 0;
                this.fade  = FadeStatus.Normal;
            }
            break;

        default:
            break;
        }

        this.guiTexture.color = Color.Lerp(Color.clear, Color.black, this.value);
    }
コード例 #4
0
ファイル: LHSplashScreens.cs プロジェクト: 15310320305/mygame
 public LHSplashScreens()
 {
     levelToLoad = "";
     m_fadeSpeed = 0.3f;
     m_waitTime  = 0.5f;
     m_status    = FadeStatus.FadeIn;
 }
コード例 #5
0
 public GameController()
 {
     levelToLoad = "";
     m_fadeSpeed = 0.3f;
     m_waitTime  = 0.5f;
     m_status    = FadeStatus.FadeIn;
 }
コード例 #6
0
 //开始淡出效果,进入游戏时切换用
 public void StartSplashGameScene(string nextScene)
 {
     ConfigureClass.nextSceneName = nextScene;
     status      = FadeStatus.FadeIn;
     levelToLoad = "dialogueScene";
     SetValue(1);
 }
コード例 #7
0
        private void Update()
        {
            switch (fadeStatus)
            {
            case FadeStatus.FADE_IN:
                spriteRenderer.color = FadeAlpha(spriteRenderer.color, true);
                if (spriteRenderer.color.a >= 1f - treshold)
                {
                    fadeStatus = FadeStatus.FADE_OUT;
                }
                break;

            case FadeStatus.FADE_OUT:
                spriteRenderer.color = FadeAlpha(spriteRenderer.color, false);
                if (spriteRenderer.color.a <= 0f + treshold)
                {
                    fadeStatus = FadeStatus.FADED;
                }
                break;

            case FadeStatus.FADED:
                SceneManager.LoadScene(1);     // 1 - main menu scene
                break;
            }
        }
コード例 #8
0
    void OnGUI()
    {
        if (logoPositioning == LogoPositioning.Centered)
        {
            splashLogoPos.x = (Screen.width * 0.5f) - (logoList[currentIndex].width * 0.5f);
            splashLogoPos.y = (Screen.height * 0.5f) - (logoList[currentIndex].height * 0.5f);

            splashLogoPos.width  = logoList[currentIndex].width;
            splashLogoPos.height = logoList[currentIndex].height;
        }
        else
        {
            splashLogoPos.x = 0;
            splashLogoPos.y = 0;

            splashLogoPos.width  = Screen.width;
            splashLogoPos.height = Screen.height;
        }

        if (logoList[currentIndex] != null)
        {
            GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, Mathf.Clamp01(alpha));
            //GUI.color = new Color(sceneBackgroundColor.r, sceneBackgroundColor.g, sceneBackgroundColor.b, 0);
            GUI.DrawTexture(splashLogoPos, logoList[currentIndex]);
            if (alpha > 1.0f)
            {
                status = FadeStatus.FadeWaiting;
                timeFadingInFinished = Time.time;
                alpha = 1.0f;
                if (splashType == SplashType.LoadNextLevelThenFadeOut && currentIndex == logoList.Length - 1)
                {
                    oldCam.depth     = -1000;
                    loadingNextLevel = true;
                    Application.LoadLevel(levelToLoad);
                }
            }
            if (alpha < 0.0f)
            {
                if (currentIndex == logoList.Length - 1)
                {
                    if (splashType == SplashType.FadeOutThenLoadNextLevel)
                    {
                        Application.LoadLevel(levelToLoad);
                    }
                    else
                    {
                        Destroy(oldCamGO);                         // somehow this doesn't work
                        Destroy(this);
                    }
                }
                else
                {
                    currentIndex++;
                    status = FadeStatus.FadeIn;
                    alpha  = 0.0f;
                }
            }
        }
    }
コード例 #9
0
 public void FadeOut()
 {
     if (_fadeStatus == FadeStatus.FadeIdle)
     {
         _fadeState  = FadeState.FadeOut;
         _fadeStatus = FadeStatus.FadeStart;
     }
 }
コード例 #10
0
ファイル: Fader.cs プロジェクト: isaacwycoff/GrimDorkness
        public Fader(Texture2D texture, Rectangle newFullScreen)
        {
            // FIXME: not using Sprite. This might be dumb.

            fadePixel = texture;
            fullScreen = newFullScreen;

            fadeStatus = FadeStatus.noFade;
            currentFade = 0.0f;
        }
コード例 #11
0
        public Fader(Texture2D texture, Rectangle newFullScreen)
        {
            // FIXME: not using Sprite. This might be dumb.

            fadePixel  = texture;
            fullScreen = newFullScreen;

            fadeStatus  = FadeStatus.noFade;
            currentFade = 0.0f;
        }
コード例 #12
0
    void Update()
    {
        switch (Status)
        {
        case FadeStatus.Wait:
            WaitTimer -= Time.deltaTime;
            if (WaitTimer <= 0.0f)
            {
                Status = FadeStatus.FadeIn;
            }
            if (Input.anyKeyDown)
            {
                TargetAlpha = 1.0f;
                Status      = FadeStatus.Keep;
            }
            break;

        case FadeStatus.FadeIn:
            TargetAlpha += Time.deltaTime * FadeSpeed;
            KeepTimer    = KeepTime;
            if (Input.anyKeyDown)
            {
                TargetAlpha = 1.0f;
                Status      = FadeStatus.Keep;
            }
            break;

        case FadeStatus.Keep:
            KeepTimer -= Time.deltaTime;
            if (KeepTimer <= 0.0f)
            {
                Status = FadeStatus.FadeOut;
            }
            if (Input.anyKeyDown)
            {
                Status = FadeStatus.End;
            }
            break;

        case FadeStatus.FadeOut:
            TargetAlpha -= Time.deltaTime * FadeSpeed;
            if (Input.anyKeyDown)
            {
                Status = FadeStatus.End;
            }
            break;

        case FadeStatus.End:
            if (!string.IsNullOrEmpty(NextScene))
            {
                SceneManager.LoadScene(NextScene);
            }
            break;
        }
    }
コード例 #13
0
 public void FadeIn(float duration)
 {
     if (m_Status == FadeStatus.None)
     {
         Show();
         m_General.SetActive(true);
         m_Teach.SetActive(false);
         m_Status       = FadeStatus.FadingIn;
         m_Timer        = 0;
         fadeInDuration = duration;
     }
 }
コード例 #14
0
    void FadeOutAnimation()
    {
        Color color = target.color;

        color.a -= Time.deltaTime * 0.5f;
        Debug.Log(color.a);
        target.color = color;
        if (color.a <= 0.0f)
        {
            status = FadeStatus.Complete;
        }
    }
コード例 #15
0
        // Fade in処理
        private void FadeIn()
        {
            var color = image_.color;

            color.a -= Time.unscaledDeltaTime * (1.0f / kFadeTime);
            if (color.a <= 0f)
            {
                // Fade in処理終了
                color.a = 0f;
                status_ = FadeStatus.kFadeNone;
            }
            image_.color = color;
        }
コード例 #16
0
        public IEnumerator BeginFadeOut()
        {
            state = FadeStatus.Fading;
            UIManager._instance.FadeScreen.gameObject.SetActive(true);
            Fade(UIManager._instance.FadeScreen.alpha, 0);
            yield return(new WaitUntil(() => !fadeInProgress()));

            if (fadeEnded != null)
            {
                fadeEnded.Invoke();
            }
            UIManager._instance.FadeScreen.gameObject.SetActive(false);
        }
コード例 #17
0
 public void FadeOut(Action callback)
 {
     m_FadeOutCallback = callback;
     m_Timer           = 0;
     if (m_Status == FadeStatus.FadingIn || m_Status == FadeStatus.Faded)
     {
         m_Status = FadeStatus.FadingOut;
     }
     else if (m_Status == FadeStatus.TeachFadingIn || m_Status == FadeStatus.Teaching)
     {
         m_Status = FadeStatus.TeachingFadeOut;
     }
 }
コード例 #18
0
ファイル: Fade.cs プロジェクト: DevMikaelNilsson/mnUtilities
 /// <summary>
 /// Resets and update the fade data.
 /// The method will activate the fade calculation by default.
 /// </summary>
 /// <param name="newFadeStatus">The new fade status. The status decides what type of calculation will be applied to the object.</param>
 /// <param name="duration">Amount of time (in seconds) the fade should take.</param>
 private void SetFadeProperties(FadeStatus newFadeStatus, float duration)
 {
     m_elapsedTime       = 0.0f;
     m_currentDuration   = duration;
     m_currentFadeStatus = newFadeStatus;
     switch (m_currentFadeStatus)
     {
     case FadeStatus.FadeIn:
     case FadeStatus.FadeOut:
         ToggleOpaqueObject(false);
         break;
     }
 }
コード例 #19
0
    void FadeIn()
    {
        if (FadeStatus.FADE_IN != fade_status_) return;
        FindBackgroundImage();
        if (background_ == null) return;

        alpha_ += -Time.deltaTime;
        if (alpha_ <= 0.0f)
        {
            fade_status_ = FadeStatus.STOP;
            alpha_ = 0.0f;
        }
        background_.color = new Color(0, 0, 0, alpha_);
    }
コード例 #20
0
ファイル: Fade.cs プロジェクト: DevMikaelNilsson/mnUtilities
        /// <summary>
        /// This method gets called whenever the fade (in/out) calculation is finished, and reset the fade variables.
        /// </summary>
        /// <summary>
        /// This method gets called whenever the fade (in/out) calculation is finished, and reset the fade variables.
        /// </summary>
        private void FadeObjectFinished()
        {
            switch (m_currentFadeStatus)
            {
            case FadeStatus.FadeIn:
                ToggleOpaqueObject(true);
                break;

            default:
                ToggleOpaqueObject(false);
                break;
            }
            m_currentFadeStatus = FadeStatus.Waiting;
        }
コード例 #21
0
        /////////////////////////////////////////////////////////////////////////
        // Private関数
        /////////////////////////////////////////////////////////////////////////
        // 初期化処理
        private void Start()
        {
            status_ = FadeStatus.kFadeIn;

            // Image Componentを探す
            image_ = GetComponentInChildren <Image>();
            Assert.IsNotNull(image_, "FadeController: Image Componentが見つからない!");

            // SortOrderを1000にする
            image_.canvas.sortingOrder = 1000;

            // ColorのAlpha値を1にする
            image_.color = new Color(0f, 0f, 0f, 1f);
        }
コード例 #22
0
 public void TeachFadeIn(string content, float duration)
 {
     if (m_Status == FadeStatus.None)
     {
         Show();
         m_General.SetActive(false);
         m_Teach.SetActive(true);
         m_TeachContent.text = content;
         m_Status            = FadeStatus.TeachFadingIn;
         m_Timer             = 0;
         fadeInDuration      = duration;
         //InitGameObjectUI();
     }
 }
コード例 #23
0
    void Update()
    {
        switch (status)
        {
        case FadeStatus.FadeIn:
            alpha += fadeSpeed * Time.deltaTime;
            if (FadeSound)
            {
                //新增 AudioListener 淡入淡出控制
                AudioListener.volume -= fadeSpeed * Time.deltaTime;
            }

            break;

        case FadeStatus.FadeWaiting:
            if ((!waitForInput && Time.time >= timeFadingInFinished + waitTime) || (waitForInput && Input.anyKey))
            {
                status = FadeStatus.FadeOut;
            }
            break;

        case FadeStatus.FadeOut:
            alpha += -fadeSpeed * Time.deltaTime * 2;
            if (FadeSound)
            {
                //新增 AudioListener 淡入淡出控制
                AudioListener.volume += fadeSpeed * Time.deltaTime * 2;
            }

            if (alpha <= 0.0f)
            {
                if (trigger != null)
                {
                    trigger();
                }

                status = FadeStatus.Paused;
                //新增:在FadeOut后删除前一个场景的相机 防止两个相机出现问题
                var cameraList = FindObjectsOfType <Camera>();
                if (cameraList.Length > 1)
                {
                    Destroy(this.gameObject);
                }
                //Additive只生效一次
                ifAdditive = false;
            }
            break;
        }
    }
コード例 #24
0
    public void StartSplashNextScene()
    {
        int sceneIndex = SceneManager.GetActiveScene().buildIndex;

        status = FadeStatus.FadeIn;
        //print("SceneManager.sceneCountInBuildSettings" + SceneManager.sceneCountInBuildSettings);
        if (sceneIndex + 1 >= SceneManager.sceneCountInBuildSettings)
        {
            levelToLoadInt = 0;
        }
        else
        {
            levelToLoadInt = sceneIndex + 1;
        }
    }
コード例 #25
0
    void FadingIn()
    {
        m_Timer += Time.deltaTime;
        float lerp = m_Timer / fadeInDuration;

        m_GeneralBG.color = Color.Lerp(new Color(0, 0, 0, 0), new Color(0, 0, 0, 1), lerp);
        Color temp = Color.Lerp(new Color(1, 1, 1, 0), new Color(1, 1, 1, 1), lerp);

        m_Spinner.color  = temp;
        image_leaf.color = temp;
        m_Text.color     = temp;
        if (lerp >= 1)
        {
            m_Status = FadeStatus.Faded;
        }
    }
コード例 #26
0
        // Fade out処理
        private void FadeOut()
        {
            var color = image_.color;

            color.a += Time.unscaledDeltaTime * (1.0f / kFadeTime);
            if (color.a >= 1f)
            {
                // Fade out処理終了
                color.a = 1f;
                status_ = FadeStatus.kFadeNone;

                // シーンの切り替え
                SceneManager.Instance.StartChange();
            }
            image_.color = color;
        }
コード例 #27
0
    public void SceneAnimated()
    {
        canvas.blocksRaycasts = true;
        switch (mStatus)
        {
        case FadeStatus.FadeIn:
        {
            canvas.alpha += FadeSpeed * Time.deltaTime;
            //Time.timeScale = 0.1f;
        }
        break;

        case FadeStatus.FadeOut:
            canvas.alpha -= FadeSpeed * Time.deltaTime;
            break;

        case FadeStatus.FadeWait:
            //当设定为FadeWait时可根据时间判定或者玩家触发进入下一个状态
            if (Time.time > mFadeInFinishedTime + WaitTime)
            {
                mStatus = FadeStatus.FadeOut;
            }
            break;
        }
        if (canvas.alpha >= 1.0F && mStatus == FadeStatus.FadeIn)
        {
            mStatus             = FadeStatus.FadeWait;
            mFadeInFinishedTime = Time.time;
            canvas.alpha        = 1.0F;
            // Time.timeScale = 1f;
        }

        if (canvas.alpha <= 0.0F)
        {
            canvas.alpha          = 0f;
            canvas.blocksRaycasts = false;
        }


        //if (mStatus == FadeStatus.FadeWait)
        //{
        //    mStatus = FadeStatus.FadeOut;

        //    //Debug.Log("请按任意键继续");

        //}
    }
コード例 #28
0
    public void CheckingFadeStatus()
    {
        float renAlpha = ghostRenderer.material.color.a;

        if (renAlpha <= 0)
        {
            currentFadeStatus = FadeStatus.FadedOut;
        }
        if (renAlpha > 0 && renAlpha < 1)
        {
            currentFadeStatus = FadeStatus.Fading;
        }
        if (renAlpha >= fullColor.a)
        {
            currentFadeStatus = FadeStatus.FadedIn;
        }
    }
コード例 #29
0
ファイル: SplashScreen.cs プロジェクト: Scopty/Spixii
    void Start()
    {
        splashLogo = new Texture2D(1, 1);
        splashLogo.SetPixel(0, 0, splashColor);
        splashLogo.Apply();
        if (startAutomatically)
        {
            status = FadeStatus.FadeIn;
        }
        else
        {
            status = FadeStatus.Paused;
        }
        oldCam   = Camera.main;
        oldCamGO = Camera.main.gameObject;

        if (logoPositioning == LogoPositioning.Centered)
        {
            splashLogoPos.x = (Screen.width * 0.5f) - (splashLogo.width * 0.5f);
            splashLogoPos.y = (Screen.height * 0.5f) - (splashLogo.height * 0.5f);

            splashLogoPos.width  = splashLogo.width;
            splashLogoPos.height = splashLogo.height;
        }
        else
        {
            splashLogoPos.x = 0;
            splashLogoPos.y = 0;

            splashLogoPos.width  = Screen.width;
            splashLogoPos.height = Screen.height;
        }



        if (splashType == SplashType.LoadNextLevelThenFadeOut)
        {
            DontDestroyOnLoad(this);
            DontDestroyOnLoad(Camera.main);
        }
        if ((Application.levelCount <= 1))
        {
            Debug.LogWarning("Invalid levelToLoad value.");
        }
    }
コード例 #30
0
ファイル: ApollonLightFader.cs プロジェクト: LABSIM/APOLLON
    }     /* Update() */

    // fade from transparent to opaque
    private System.Collections.IEnumerator FadeIn()
    {
        // mark as Running
        this.m_fadeStatus = FadeStatus.Running;

        // extract last one
        FadeRequest current_request = null;

        lock (this.m_requestQueue) { current_request = this.m_requestQueue.Peek(); }

        // loop over m_fadeDuration time
        for (float i = 0.0f; i <= current_request.m_fadeDuration; i += UnityEngine.Time.deltaTime)
        {
            // smoothly update intensity
            foreach (var light in this.Lights)
            {
                light.intensity
                    = UnityEngine.Mathf.Clamp(
                          (1.0f - i / current_request.m_fadeDuration),
                          0.0f,
                          1.0f
                          );
            } /* foreach() */

            // yield
            yield return(null);
        } /* for() */

        // finally, zeroing intensity
        foreach (var light in this.Lights)
        {
            light.intensity = 0.0f;
        } /* foreach() */

        // flush last one
        lock (this.m_requestQueue)
        {
            // flush last one
            this.m_requestQueue.Dequeue();
        }

        // mark as Pending
        this.m_fadeStatus = FadeStatus.Pending;
    } /* FadeIn() */
コード例 #31
0
        private void Update()
        {
            switch (_fadeStatus)
            {
            case FadeStatus.FadeIdle:
                return;

            case FadeStatus.FadeStart:
                CallOnBeginFade?.Invoke();
                _fadeStatus = FadeStatus.FadeInProgress;
                break;

            case FadeStatus.FadeInProgress:
                switch (_fadeState)
                {
                case FadeState.FadeOut:
                    _canvasGroup.alpha = Mathf.Lerp(_canvasGroup.alpha, 0, Time.deltaTime * _fadeSpeed);
                    if (_canvasGroup.alpha < 0.01f)
                    {
                        _fadeStatus = FadeStatus.FadeEnd;
                    }

                    break;

                case FadeState.FadeIn:
                    Mathf.Lerp(_canvasGroup.alpha, 1, _fadeSpeed * Time.deltaTime);
                    if (_canvasGroup.alpha > 0.9f)
                    {
                        _fadeStatus = FadeStatus.FadeEnd;
                    }

                    break;
                }

                break;

            case FadeStatus.FadeEnd:
                CallOnEndFade?.Invoke();
                Destroy(_canvasGroup);
                _fadeStatus = FadeStatus.FadeIdle;
                gameObject.SetActive(false);
                break;
            }
        }
コード例 #32
0
    void OnGUI()
    {
        if (SplashLogo != null)
        {
            //绘制Logo
            GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, Mathf.Clamp(mAlpha, 0, 1));
            GUI.DrawTexture(mSplashLogoPos, SplashLogo);

            //状态判断
            if (mAlpha > 1.0F)
            {
                mStatus             = FadeStatus.FadeWait;
                mFadeInFinishedTime = Time.time;
                mAlpha = 1.0F;
                //如果需要在渐入结束后加载关卡
                if (Type == SplashType.LoadLevelThenFadeOut)
                {
                    mCam.depth = -1000;
                }
            }

            if (mAlpha < 0.0F)
            {
                //如果需要在关卡加载完后渐出
                if (Type == SplashType.FadeOutThenLoadLevel)
                {
                    SceneManager.LoadScene(levelToLoad);
                    // Application.LoadLevel("sence2");
                }
                else
                {
                    Destroy(mCamObj);
                    Destroy(this);
                }
            }
        }

        if (mStatus == FadeStatus.FadeWait)
        {
            mStatus = FadeStatus.FadeOut;
            StartCoroutine("loadSence2");
            //Debug.Log("请按任意键继续");
        }
    }
コード例 #33
0
ファイル: SceneLoad.cs プロジェクト: sorpcboy/moredo
	void Start ()
	{
		//是否自动淡入淡出
		if(startAutomatically)
		{
			status = FadeStatus.FadeIn;
		}
		else
		{
			status = FadeStatus.Paused;
		}
		//指定摄像机
		oldCam = Camera.main;
		oldCamGO = Camera.main.gameObject;
		//载入图位置大小判断
		if(logoPositioning == LogoPositioning.Centered)
		{
			splashLogoPos.x = (Screen.width * 0.5f) - (splashLogo.width * 0.5f);
			splashLogoPos.y = (Screen.height * 0.5f) - (splashLogo.height * 0.5f);
			
			splashLogoPos.width = splashLogo.width;
			splashLogoPos.height = splashLogo.height;
		}
		else
		{
			splashLogoPos.x = 0;
			splashLogoPos.y = 0;
			
			splashLogoPos.width = Screen.width;
			splashLogoPos.height = Screen.height;
		}
		
		if(splashType == SplashType.LoadNextLevelThenFadeOut)
		{
			DontDestroyOnLoad(this);
			DontDestroyOnLoad(Camera.main);
		}
		//判断待加载场景是否为空
		if((Application.levelCount <= 1)||(levelToLoad == ""))
		{
			Debug.LogWarning("Invalid levelToLoad value.");
		}
	}
コード例 #34
0
ファイル: SplashScreen.cs プロジェクト: adahera222/DaVinci
 void Update()
 {
     switch (status)
     {
         case FadeStatus.FadeIn:
             alpha += fadeSpeed * Time.deltaTime;
             break;
         case FadeStatus.FadeWaiting:
             if ((!waitForInput && Time.time >= timeFadingInFinished + waitTime) || (waitForInput && Input.anyKey))
             {
                 alpha = 1.0f;
                 status = FadeStatus.FadeOut;
             }
             break;
         case FadeStatus.FadeOut:
             alpha += -fadeSpeed * Time.deltaTime;
             break;
         case FadeStatus.Paused:
             break;
     }
 }
コード例 #35
0
 void OnGUI()
 {
     //图片Alpha控制
     GUI.depth = guiDepth;
     if (splashLogo != null)
     {
         GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, Mathf.Clamp01(alpha));
         GUI.DrawTexture(splashLogoPos, splashLogo);
     }
     if (alpha > 1.0f)
     {
         status = FadeStatus.FadeWaiting;
         timeFadingInFinished = Time.time;
         alpha = 1.0f;
         if (splashType == SplashType.LoadNextLevelThenFadeOut)
         {
             oldCamera.depth = -1000;
             loadingNextLevel = true;
             if ((Application.levelCount) >= 1 && (levelStringToLoad != ""))
             {
                 Application.LoadLevel(levelStringToLoad);
             }
         }
     }
     if (alpha < 0.0f)
     {
         if (splashType == SplashType.FadeOutThenLoadNextLevel)
         {
             if ((Application.levelCount >= 1) || (levelStringToLoad != ""))
             {
                 Application.LoadLevel(levelStringToLoad);
             }
         }
         else
         {
             Destroy(oldCamGameObject);
             Destroy(oldCamera);
         }
     }
 }
コード例 #36
0
 void OnGUI()
 {
     GUI.depth = guiDepth;
     if (splashLogo != null)
     {
         GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, Mathf.Clamp01(alpha));
         GUI.DrawTexture(splashLogoPos, splashLogo);
         if (alpha > 1.0f)
         {
             status = FadeStatus.FadeWaiting;
             timeFadingInFinished = Time.time;
             alpha = 1.0f;
             if (splashType == SplashType.LoadNextLevelThenFadeOut)
             {
                 oldCam.depth = -1000;
                 loadingNextLevel = true;
                 if ((Application.levelCount >= 1) && (levelToLoad != ""))
                 {
                     Application.LoadLevel(levelToLoad);
                 }
             }
         }
         if (alpha < 0.0f)
         {
             if (splashType == SplashType.FadeOutThenLoadNextLevel)
             {
                 if ((Application.levelCount >= 1) && (levelToLoad != ""))
                 {
                     Application.LoadLevel(levelToLoad);
                 }
             }
             else
             {
                 Destroy(oldCamGO); // somehow this doesn't work
                 Destroy(this);
             }
         }
     }
 }
コード例 #37
0
    void OnGUI()
    {
        GUI.depth = guiDepth;
        if (splashLogo != null)
        {
            GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, Mathf.Clamp01(alpha));
            GUI.DrawTexture(splashLogoPos, splashLogo);
        }
        if (alpha > 1.0f)
        {

            status = FadeStatus.FadeWaiting;
            timeFadingInFinished = Time.time;
            alpha = 1.0f;
            if (splashType == SplashType.LoadNextLevelThenFadeOut)
            {
                                loadingNextLevel = true;
                if ((Application.levelCount) >= 1)
                {
                    //print(levelToLoadInt);
                    //Application.LoadLevel(levelToLoadInt);
                    Application.LoadLevel(levelToLoad);
                    if (triggerAtLoading != null)
                        triggerAtLoading();
                }
            }
        }
        if (alpha < 0.0f)
        {
            if (splashType == SplashType.FadeOutThenLoadNextLevel)
            {
                if (Application.levelCount >= 1)
                {
                    //Application.LoadLevel(levelToLoadInt);
                    Application.LoadLevel(levelToLoad);
                }
            }
            else
            {

            }
        }
    }
コード例 #38
0
    void Update()
    {
        switch (status)
        {
            case FadeStatus.FadeIn:

                alpha += fadeSpeed * Time.deltaTime;
                break;
            case FadeStatus.FadeWaiting:
                if ((!waitForInput && Time.time >= timeFadingInFinished + waitTime) || (waitForInput && Input.anyKey))
                {
                    status = FadeStatus.FadeOut;

                }
                break;
            case FadeStatus.FadeOut:
                alpha += -fadeSpeed * Time.deltaTime * 2;
                if (alpha <= 0.0f)
                {
                    if (trigger != null)
                    {
                        trigger();
                    }

                    status = FadeStatus.Paused;

                }
                break;
        }
    }
コード例 #39
0
ファイル: Fade.cs プロジェクト: DevMikaelNilsson/mnUtilities
 /// <summary>
 /// Resets and update the fade data.
 /// The method will activate the fade calculation by default.
 /// </summary>
 /// <param name="newFadeStatus">The new fade status. The status decides what type of calculation will be applied to the object.</param>
 /// <param name="duration">Amount of time (in seconds) the fade should take.</param>
 private void SetFadeProperties(FadeStatus newFadeStatus, float duration)
 {
     m_elapsedTime = 0.0f;
     m_currentDuration = duration;
     m_currentFadeStatus = newFadeStatus;
     switch(m_currentFadeStatus)
     {
         case FadeStatus.FadeIn:
         case FadeStatus.FadeOut:
             ToggleOpaqueObject(false);
             break;
     }
 }
コード例 #40
0
ファイル: SceneLoad.cs プロジェクト: zergcom/unity
 public void FadeOut()
 {
     Status = FadeStatus.FadeOut;
     alpha = 0.0f;
 }
コード例 #41
0
    void FadeOut()
    {
        if (FadeStatus.FADE_OUT != fade_status_) return;
        if (background_ == null) return;

        alpha_ += Time.deltaTime;
        if (alpha_ >= 1.0f)
        {
            fade_status_ = FadeStatus.FADE_IN;
            alpha_ = 1.0f;
            Destroy(scene_);

            var scene = scene_list_[type_];

            scene_ = Instantiate(scene);
            scene_.name = scene_list_[type_].name;
        }
        background_.color = new Color(0, 0, 0, alpha_);
    }
コード例 #42
0
ファイル: Fade.cs プロジェクト: DevMikaelNilsson/mnUtilities
 /// <summary>
 /// This method gets called whenever the fade (in/out) calculation is finished, and reset the fade variables.
 /// </summary>
 /// <summary>
 /// This method gets called whenever the fade (in/out) calculation is finished, and reset the fade variables.
 /// </summary>
 private void FadeObjectFinished()
 {
     switch(m_currentFadeStatus)
     {
         case FadeStatus.FadeIn:
             ToggleOpaqueObject(true);
             break;
         default:
             ToggleOpaqueObject(false);
             break;
     }
     m_currentFadeStatus = FadeStatus.Waiting;
 }
コード例 #43
0
ファイル: SplashScreen.cs プロジェクト: Scopty/Spixii
    void Start()
    {
        splashLogo = new Texture2D(1, 1);
        splashLogo.SetPixel(0, 0, splashColor);
        splashLogo.Apply();
        if (startAutomatically)
        {
            status = FadeStatus.FadeIn;
        }
        else
        {
            status = FadeStatus.Paused;
        }
        oldCam = Camera.main;
        oldCamGO = Camera.main.gameObject;

        if (logoPositioning == LogoPositioning.Centered)
        {
            splashLogoPos.x = (Screen.width * 0.5f) - (splashLogo.width * 0.5f);
            splashLogoPos.y = (Screen.height * 0.5f) - (splashLogo.height * 0.5f);

            splashLogoPos.width = splashLogo.width;
            splashLogoPos.height = splashLogo.height;
        }
        else
        {
            splashLogoPos.x = 0;
            splashLogoPos.y = 0;

            splashLogoPos.width = Screen.width;
            splashLogoPos.height = Screen.height;
        }

        if (splashType == SplashType.LoadNextLevelThenFadeOut)
        {
            DontDestroyOnLoad(this);
            DontDestroyOnLoad(Camera.main);
        }
        if ((Application.levelCount <= 1))
        {
            Debug.LogWarning("Invalid levelToLoad value.");
        }
    }
コード例 #44
0
ファイル: SplashScreen.cs プロジェクト: JeanJoanisse/Strain
    void Start()
    {
        if (startAutomatically)
        {
            status = FadeStatus.FadeIn;
        }
        else
        {
            status = FadeStatus.Paused;
        }
        oldCam = Camera.main;
        oldCamGO = Camera.main.gameObject;

        if (logoPositioning == LogoPositioning.Centered)
        {
            splashLogoPos.x = (Screen.width * 0.5f) - (splashLogo.width * 0.5f);
            splashLogoPos.y = (Screen.height * 0.5f) - (splashLogo.height * 0.5f);

            splashLogoPos.width = splashLogo.width;
            splashLogoPos.height = splashLogo.height;
        }
        else
        {
            splashLogoPos.x = 0;
            splashLogoPos.y = 0;

            splashLogoPos.width = Screen.width;
            splashLogoPos.height = Screen.height;
        }

        if (splashType == SplashType.LoadNextLevelThenFadeOut)
        {
            DontDestroyOnLoad(this);
            DontDestroyOnLoad(Camera.main);
        }
        if ((Application.levelCount <= 1) || (levelToLoad == ""))
        {
            Debug.LogWarning("Invalid levelToLoad value.");
        }
         AudioManager.Instance.BGMPlay(AudioManager.Instance.songArray[0],Vector3.zero,1);
    }
コード例 #45
0
 //Begin to switch
 public void StartSplash(int i)
 {
     status = FadeStatus.FadeIn;
     //levelToLoadInt = level;
     SetValue(i);
 }
コード例 #46
0
ファイル: Fader.cs プロジェクト: isaacwycoff/GrimDorkness
 public void fadeIn(float newFadeShift)
 {
     currentFade = FADE_OPAQUE;
     fadeStatus = FadeStatus.fadeIn;
     fadeShift = newFadeShift;
 }
コード例 #47
0
    void Start()
    {
        levelStringToLoad = SceneNameHelper.getNextSceneName();

        if (startAutomatically)
        {
            status = FadeStatus.FadeIn;
        }
        else
        {
            status = FadeStatus.Paused;
        }

        oldCamera = Camera.main;
        oldCamGameObject = Camera.main.gameObject;

        if (logoPositioning == LogoPositioning.Centered)
        {
            splashLogoPos.x = (Screen.width * 0.5f) - (splashLogo.width * 0.5f);
            splashLogoPos.y = (Screen.height * 0.5f) - (splashLogo.height * 0.5f);

            splashLogoPos.width = splashLogo.width;
            splashLogoPos.height = splashLogo.height;
        }
        else
        {
            splashLogoPos.x = 0;
            splashLogoPos.y = 0;

            splashLogoPos.width = Screen.width;
            splashLogoPos.height = Screen.height;
        }

        if (splashType == SplashType.LoadNextLevelThenFadeOut)
        {
            DontDestroyOnLoad(this);
            DontDestroyOnLoad(Camera.main);
        }

        if ((Application.levelCount <= 1) || (levelStringToLoad == ""))
        {
            Debug.LogWarning("Invalid levelToLoad value.");
        }
    }
コード例 #48
0
 public void StartSplash()
 {
     status = FadeStatus.FadeIn;
 }
コード例 #49
0
 public void Trasition(Type type)
 {
     type_ = type;
     fade_status_ = FadeStatus.FADE_OUT;
     FindBackgroundImage();
 }
コード例 #50
0
ファイル: SplashScreen.cs プロジェクト: adahera222/DaVinci
 public void StartFade()
 {
     status = FadeStatus.FadeWaiting;
 }
コード例 #51
0
ファイル: SplashScreen.cs プロジェクト: melodyb/bees
    void Start()
    {
        if (startAutomatically)
        {
            status = FadeStatus.FadeIn;
        }
        else
        {
            status = FadeStatus.Paused;
        }
        oldCam = Camera.main;
        oldCamGO = Camera.main.gameObject;

        if (logoPositioning == LogoPositioning.Centered)
        {
            float logoMarginWidth = splashLogo.width + 2.0f * logoMargin;
            float logoMarginHeight = splashLogo.height + 2.0f * logoMargin;

            if (logoMarginWidth / logoMarginHeight > Screen.width / Screen.height)
            {
                splashLogoPos.x = logoMargin;
                splashLogoPos.width = Screen.width - 2.0f * logoMargin;

                splashLogoPos.height = splashLogoPos.width * splashLogo.height / splashLogo.width;
                splashLogoPos.y = (Screen.height - splashLogoPos.height) / 2.0f;
            }
            else
            {
                splashLogoPos.y = logoMargin;
                splashLogoPos.height = Screen.height - 2.0f * logoMargin;

                splashLogoPos.width = splashLogoPos.height * splashLogo.width / splashLogo.height;
                splashLogoPos.x = (Screen.width - splashLogoPos.width) / 2.0f;
            }
        }
        else
        {
            splashLogoPos.x = 0;
            splashLogoPos.y = 0;

            splashLogoPos.width = Screen.width - 2.0f * logoMargin;
            splashLogoPos.height = Screen.height - 2.0f * logoMargin;
        }



        if (splashType == SplashType.LoadNextLevelThenFadeOut)
        {
            DontDestroyOnLoad(this);
            DontDestroyOnLoad(Camera.main);
        }
        if ((SceneManager.sceneCountInBuildSettings <= 1) || (sceneToLoad == ""))
        {
            Debug.LogWarning("Invalid sceneToLoad value.");
        }
    }
コード例 #52
0
ファイル: Fader.cs プロジェクト: isaacwycoff/GrimDorkness
 public void fadeOut(float newFadeShift)
 {
     currentFade = FADE_TRANSPARENT;
     fadeStatus = FadeStatus.fadeOut;
     fadeShift = newFadeShift;
 }
コード例 #53
0
ファイル: SceneLoad.cs プロジェクト: zergcom/unity
 //public void FadeIn()
 //{
 //    Status = FadeStatus.FadeIn;
 //    alpha = 1.0f;
 //}
 void Update()
 {
     switch (Status)
     {
         case FadeStatus.FadeOut:
             alpha += FadeSpeed * Time.deltaTime;
             if (alpha >= 1.0f)
             {
                 Status = FadeStatus.Paused;
                 Application.LoadLevel(NextSceneName);
             }
             break;
         case FadeStatus.FadeIn:
             alpha -= FadeSpeed * Time.deltaTime * 2;
             if (alpha <= 0.0f)
             {
                 Status = FadeStatus.Paused;
             }
             break;
     }
 }