当前位置: 首页>>代码示例>>C#>>正文


C# FadeState类代码示例

本文整理汇总了C#中FadeState的典型用法代码示例。如果您正苦于以下问题:C# FadeState类的具体用法?C# FadeState怎么用?C# FadeState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FadeState类属于命名空间,在下文中一共展示了FadeState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

 void Update()
 {
     //if (oldFadeState != fadeState)
     //{
     //    OnChangeFadeState();
     //    oldFadeState = fadeState;
     //}
     
     float deltaTime = Time.deltaTime;
     
     if (fadeState == FadeState.FromFade)
     {
         colorAlpha -= speed * deltaTime;
         if (colorAlpha <= 0.0f)
         {
             colorAlpha = 0.0f;
             fadeState = FadeState.Nothing;
         }
         blackMat.color = new Color(1.0f, 1.0f, 1.0f, colorAlpha);
     }
     else if (fadeState == FadeState.ToFade)
     {
         colorAlpha += speed * deltaTime;
         if (colorAlpha >= 1.0f)
         {
             colorAlpha = 1.0f;
             fadeState = FadeState.Nothing;
         }
         blackMat.color = new Color(1.0f, 1.0f, 1.0f, colorAlpha);
     }
 }
开发者ID:shikoist,项目名称:tanks,代码行数:31,代码来源:Fade.cs

示例2: Update

    private void Update()
    {
        switch(fadeState)
        {
            case FadeState.FadeIn:
                if (alpha < ColorConcentration.max)
                {
                    alpha += speed * Time.deltaTime;
                }
                else
                {
                    alpha = ColorConcentration.max;
                    fadeState = FadeState.FadeOut;
                }
                break;

            case FadeState.FadeOut:
                if (alpha > ColorConcentration.min)
                {
                    alpha -= speed * Time.deltaTime;
                }
                else
                {
                    alpha = ColorConcentration.min;
                    fadeState = FadeState.FadeIn;
                }
                break;
        }

        color = new Color(color.r, color.g, color.b, alpha);
        GetComponent<Renderer>().material.color = color;
    }
开发者ID:Kuvo,项目名称:Primary,代码行数:32,代码来源:FlashingCursor.cs

示例3: OnGUI

 void OnGUI()
 {
     GUI.depth = depth;
     if(fs != FadeState.NONE){
         switch(fs){
         case FadeState.FADEIN:
             GUI.DrawTexture(new Rect(posFadex*Screen.width, 0f, Screen.width*2f, Screen.height), fade);
             posFadex -= Time.deltaTime/speedFade;
             if(posFadex <= posxfinal){
                 fs = FadeState.DISPLAY;
                 if(!String.IsNullOrEmpty(levelToLoad)) Application.LoadLevel(DataManager.Instance.giveLevelToLoad(levelToLoad));
             }
             break;
         case FadeState.FADEOUT:
             GUI.DrawTexture(new Rect(posFadex*Screen.width, 0f, Screen.width*2f, Screen.height), fade);
             posFadex += Time.deltaTime/speedFade;
             if(posFadex >= 1f){
                 fs = FadeState.NONE;
                 if(disableWhenFinish)
                 {
                     this.enabled = false;
                 }
             }
             break;
         case FadeState.DISPLAY:
             GUI.DrawTexture(new Rect(posFadex*Screen.width, 0f, Screen.width*2f, Screen.height), fade);
             break;
         }
     }
 }
开发者ID:BenouKat,项目名称:Unity-ITGHD,代码行数:30,代码来源:FadeManager.cs

示例4: HandleShotState

    private void HandleShotState()
    {
        if (CurrentFade == FadeState.None)
        {
            SplineProgress += (Shots[CurrentShot].Velocity / Shots[CurrentShot].Path.GetDeriv(SplineProgress).magnitude)*Time.deltaTime;
            Vector3 diff = Shots[CurrentShot].Path.GetPoint(Shots[CurrentShot].Path.GetCurveCount())
                         - Shots[CurrentShot].Path.GetPoint(SplineProgress);

            if ((float)Shots[CurrentShot].Path.GetCurveCount() - SplineProgress < 0.05f)
            {
                CurrentFade = FadeState.FadeOut;
                FadeStartTime = Time.time;
            }
        }
        else if (Time.time >= FadeStartTime + FadeLength)
        {
            if (CurrentFade == FadeState.FadeIn)
            {
                FadeStartTime = -1;
                CurrentFade = FadeState.None;
            } else
            {
                CurrentShot++;
                CurrentShot %= Shots.Length;
                SplineProgress = 0;
                FadeStartTime = Time.time;

                CurrentFade = FadeState.FadeIn;
            }
        }
    }
开发者ID:Flafla2,项目名称:Unity-Splines,代码行数:31,代码来源:SplineCameraFollower.cs

示例5: Update

    void Update()
    {
        if (_fadeState == FadeState.Idle)
            return;

        _timer += Time.deltaTime;
        numerator += Time.deltaTime * (int)_fadeState;
        if (_timer >= _halfTime && _fadeState == FadeState.Into)
        {
                if (onFadeIn != null)
                    onFadeIn();

                _fadeState = FadeState.Outto;
        }
        else if(_timer >= fadeTime && _fadeState == FadeState.Outto)
        {
            Debug.Log("Delta is : " + Time.deltaTime);
            if (onFadeOut != null)
                onFadeOut();

            _fadeState = FadeState.Idle;
            _timer = 0;
            numerator = 0;
        }

        float perc = Mathf.Clamp01(numerator / _halfTime);
        color.a = perc;
        img.color = color;
        Debug.Log("Color A : " + img.color.a);
    }
开发者ID:Nodgez,项目名称:Sneaky-Blocks,代码行数:30,代码来源:FadePanel.cs

示例6: UpdateLevelChangeCheck

    void UpdateLevelChangeCheck()
    {
        if (isEnableLevelChange && !isRequestExit && !isRequestCustomLevelChange)
        {
            if (!isEnableFadeIn || fadeAlpha <= 0.0f)
            {
                if (Time.time - startTime > showTimeSec)
                    isRequestExit = true;
                else if (isExitWithAnyKey && Input.anyKeyDown && Time.time - startTime > minsShowTimeSec)
                    isRequestExit = true;
            }
        }

        bool isExit = (isRequestExit || isRequestCustomLevelChange);
        if (isEnableFadeOut)
        {
            if (isExit)
                fadingState = FadeState.FADE_OUT;
            if (fadingState == FadeState.FADE_OUT && fadeAlpha < 1.0f)
                isExit = false;
        }

        if (isExit && !isAlreadyCallExit)
        {
            isAlreadyCallExit = true;
			SceneManager.LoadScene(isRequestCustomLevelChange ? customTargetLevel : targetLevel);
        }
    }
开发者ID:ClazzX1,项目名称:BussStopOCD,代码行数:28,代码来源:SplashScreen.cs

示例7: FadeOut

 public void FadeOut(float time)
 {
     fadeState = FadeState.FadeOut;
     fadeTimer = maxFadeTime = (int)(1000.0f * time);
     fadeIdleTime = 0;
     fadeValue = 1.0f;
 }
开发者ID:northdocks,项目名称:ggj-2012-splash-damage,代码行数:7,代码来源:FadeHelper.cs

示例8: BeginFadeOut

 public void BeginFadeOut(double fadeDurationInMilliseconds) {
     lock (lockObject) {
         fadeSamplePosition = 0;
         fadeSampleCount = (int)((fadeDurationInMilliseconds * source.WaveFormat.SampleRate) / 1000);
         fadeState = FadeState.FadingOut;
     }
 }
开发者ID:bearhack145,项目名称:fluid-vocal,代码行数:7,代码来源:FadeInOutSampleProvider.cs

示例9: Fade

    private void Fade( bool fadeIn )
    {
        float a = TimeLeft/FadeDuration;
        if ( a < 0 )
        {
            a = 0;
            Status = FadeState.None;

            if ( !fadeIn )
            {
                GuiText.text = "";
            }
        }

        if ( fadeIn )
        {
            a = 1 - a;
        }

        Color temp = GuiText.font.material.color;/* * GuiTextAlphaOriginal*/;
        temp.a = a;
        GuiText.font.material.color = temp;

        if ( Background )
        {
            temp = Background.color;
            temp.a = a*BackgroundAlphaOriginal;

            Background.color = temp;
        }
    }
开发者ID:Jonas90,项目名称:iss,代码行数:31,代码来源:HoveringText.cs

示例10: Start

    // Use this for initialization
    void Start()
    {
        this.TextObject = this.GetComponentInChildren<TextMesh>();
        this.Particles = this.GetComponentInChildren<ParticleSystem>();
        this.TextProperty = Text;

        this.State = FadeState.FadeIn;
    }
开发者ID:GhostTap,项目名称:SolarStrike,代码行数:9,代码来源:Achievement.cs

示例11: FadeIn

 public void FadeIn(float time, float idleTime)
 {
     fadeState = FadeState.FadeIn;
     fadeTimer = maxFadeTime = (int)(1000.0f * time);
     fadeIdleTime = -(int)(1000.0f * idleTime);
     fadeTimer -= fadeIdleTime;
     fadeValue = 0.0f;
 }
开发者ID:northdocks,项目名称:ggj-2012-splash-damage,代码行数:8,代码来源:FadeHelper.cs

示例12: StopHighlight

        /// <summary>
        ///   Stops highlighting the target sprite by fading it in and stopping fading.
        /// </summary>
        public void StopHighlight()
        {
            if (this.fadeState == FadeState.None || this.fadeState == FadeState.FadeInAndStop)
            {
                return;
            }

            this.fadeState = FadeState.FadeInAndStop;
        }
开发者ID:jixiang111,项目名称:slash-framework,代码行数:12,代码来源:HighlightSpriteAlpha.cs

示例13: Start

 // Use this for initialization
 void Start()
 {
     fade = (Texture2D) Resources.Load("Fade");
     fs = FadeState.NONE;
     if(startFeded){
         fs = FadeState.DISPLAY;
         posFadex = posxfinal;
     }
 }
开发者ID:bobwister,项目名称:Unity-ITGHD,代码行数:10,代码来源:FadeManager.cs

示例14: ViewOnTarget

    // =============================================================================
    // =============================================================================
    // METHODS  --------------------------------------------------------------------
    public void ViewOnTarget( Transform target, Vector3 offset, string text )
    {
        Status = FadeState.FadeIn;
        TransTarget = target;
        TransTargetOffset = offset;
        GuiText.text = text;

        TimeStart = Time.time;
    }
开发者ID:Jonas90,项目名称:iss,代码行数:12,代码来源:HoveringText.cs

示例15: StartHighlight

        /// <summary>
        ///   Starts highlighting the target sprite by fading it in and out.
        /// </summary>
        public void StartHighlight()
        {
            if (this.fadeState == FadeState.FadeIn || this.fadeState == FadeState.FadeOut)
            {
                return;
            }

            this.fadeState = FadeState.FadeOut;
        }
开发者ID:jixiang111,项目名称:slash-framework,代码行数:12,代码来源:HighlightSpriteAlpha.cs


注:本文中的FadeState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。