本文整理汇总了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);
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
示例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);
}
}
示例7: FadeOut
public void FadeOut(float time)
{
fadeState = FadeState.FadeOut;
fadeTimer = maxFadeTime = (int)(1000.0f * time);
fadeIdleTime = 0;
fadeValue = 1.0f;
}
示例8: BeginFadeOut
public void BeginFadeOut(double fadeDurationInMilliseconds) {
lock (lockObject) {
fadeSamplePosition = 0;
fadeSampleCount = (int)((fadeDurationInMilliseconds * source.WaveFormat.SampleRate) / 1000);
fadeState = FadeState.FadingOut;
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例13: Start
// Use this for initialization
void Start()
{
fade = (Texture2D) Resources.Load("Fade");
fs = FadeState.NONE;
if(startFeded){
fs = FadeState.DISPLAY;
posFadex = posxfinal;
}
}
示例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;
}
示例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;
}