public override void Play()
    {
        base.Play();
        ListView <Material> mats = this.owner.mats;

        for (int i = 0; i < mats.Count; i++)
        {
            Material material = mats[i];
            material.SetTexture(this.texParamName, this.tex);
        }
        if (this.fadeInterval == 0f)
        {
            this.enableFade = false;
        }
        if (this.hasFadeFactor)
        {
            float factor = this.enableFade ? 0f : 1f;
            this.SetFactor(factor);
        }
        else
        {
            this.enableFade = false;
        }
        this.fadeState = SMaterialEffect_Base.FadeState.FadeIn;
        this.fadeTimer.Start();
    }
 public override void OnRelease()
 {
     base.owner        = null;
     this.minAlpha     = 0.3f;
     this.enableFade   = true;
     this.fadeState    = SMaterialEffect_Base.FadeState.FadeIn;
     this.fadeInterval = 0.05f;
 }
 public void BeginFadeOut()
 {
     if (this.fadeState != SMaterialEffect_Base.FadeState.FadeOut)
     {
         this.fadeTimer.Start();
         this.fadeState = SMaterialEffect_Base.FadeState.FadeOut;
     }
 }
 public override void OnRelease()
 {
     this.owner         = null;
     this.texParamName  = string.Empty;
     this.fadeParamName = string.Empty;
     this.tex           = null;
     this.factorScale   = 1f;
     this.enableFade    = false;
     this.hasFadeFactor = false;
     this.fadeState     = SMaterialEffect_Base.FadeState.FadeIn;
     this.fadeInterval  = 0f;
 }
    public override void Play()
    {
        if (this.fadeInterval == 0f)
        {
            this.enableFade = false;
        }
        float factor = !this.enableFade ? 1f : 0f;

        this.SetTranslucent(true);
        this.SetAlpha(factor);
        this.fadeState = SMaterialEffect_Base.FadeState.FadeIn;
        this.fadeTimer.Start();
    }
    public override void Play()
    {
        if (this.fadeInterval == 0f)
        {
            this.enableFade = false;
        }
        float alpha = (!this.enableFade) ? 1f : 0f;

        this.SetTranslucent(this.owner.mats, true);
        this.SetAlpha(alpha);
        this.fadeState = SMaterialEffect_Base.FadeState.FadeIn;
        this.fadeTimer.Start();
    }
Esempio n. 7
0
 public void Replay(Texture newTex)
 {
     base.AllocId();
     if (this.tex != newTex)
     {
         this.tex = newTex;
         ListView <Material> mats = base.owner.mats;
         for (int i = 0; i < mats.Count; i++)
         {
             mats[i].SetTexture(this.texParamName, newTex);
         }
     }
     if (this.fadeState == SMaterialEffect_Base.FadeState.FadeOut)
     {
         this.fadeState = SMaterialEffect_Base.FadeState.FadeIn;
     }
 }
Esempio n. 8
0
    public static bool UpdateFadeState(out float factor, ref SMaterialEffect_Base.FadeState fadeState, ref SMaterialEffect_Base.STimer fadeTime, float fadeInterval, bool forceUpdate = false)
    {
        bool result = false;

        factor = 1f;
        if (fadeState == SMaterialEffect_Base.FadeState.FadeIn)
        {
            float num = fadeTime.Update();
            if (num >= fadeInterval)
            {
                factor    = 1f;
                fadeState = SMaterialEffect_Base.FadeState.Normal;
            }
            else
            {
                factor = num / fadeInterval;
            }
            result = true;
        }
        else if (fadeState == SMaterialEffect_Base.FadeState.FadeOut)
        {
            float num2 = fadeTime.Update();
            if (num2 >= fadeInterval)
            {
                factor    = 0f;
                fadeState = SMaterialEffect_Base.FadeState.Stopped;
            }
            else
            {
                factor = 1f - num2 / fadeInterval;
            }
            result = true;
        }
        if (forceUpdate)
        {
            result = true;
        }
        return(result);
    }