示例#1
0
 protected override void Parse(ref BitStreamReader bsr)
 {
     Duration = bsr.ReadUShort() / (float)(1 << 9);             // might be useful: #define SCREENFADE_FRACBITS 9
     HoldTime = bsr.ReadUShort();
     Flags    = (FadeFlags)bsr.ReadUShort();
     R        = bsr.ReadByte();
     G        = bsr.ReadByte();
     B        = bsr.ReadByte();
     A        = bsr.ReadByte();
 }
示例#2
0
    public IEnumerator Fade(FadeFlags flags)
    {
        bool toWhite = (flags & FadeFlags.ToWhite) == FadeFlags.ToWhite;

        if (toWhite)
        {
            rend.enabled = true;
        }
        Color current = rend.material.color,
              target  = current;

        target.a = toWhite ? 1 : 0;
        float time = 0;

        while (time < FADE_TIME)
        {
            current             = rend.material.color;
            current.a           = toWhite ? time / FADE_TIME : 1 - (time / FADE_TIME);
            rend.material.color = current;
            time += Time.deltaTime;
            yield return(null);
        }
        rend.material.color = target;
        if (toWhite && (flags & FadeFlags.Interactive) == FadeFlags.Interactive)
        {
            interactive = true;
            col.enabled = interactive;
        }
        else
        {
            rend.enabled = false;
            if ((flags & FadeFlags.DelayedInvoke) == FadeFlags.DelayedInvoke && delayed)
            {
                onPull.Invoke();
            }
        }
    }