Esempio n. 1
0
        private static IEnumerator Dim(PiecewiseRender pr, Color color, float bop, float overT = 0.2f)
        {
            if (pr.cT?.Cancelled == true)
            {
                yield break;
            }
            Color baseColor = pr.lastColor;
            float baseBop   = pr.lastBop;

            for (float t = 0; t < overT; t += ETime.FRAME_TIME)
            {
                pr.lastColor = Color.Lerp(baseColor, color, t / overT).WithA(pr.lastColor.a);
                float nextBop = baseBop + M.EOutSine(t / overT) * (bop - baseBop);
                foreach (var sr in pr.spriteRenders)
                {
                    sr.color = pr.lastColor;
                    var p = sr.transform.localPosition;
                    p.y += (nextBop - pr.lastBop);
                    sr.transform.localPosition = p;
                }
                pr.lastBop = nextBop;
                if (pr.cT?.Cancelled == true)
                {
                    yield break;
                }
                yield return(null);
            }
            pr.lastColor = color.WithA(pr.lastColor.a);
        }
Esempio n. 2
0
 private PiecewiseRender NewPiecewise(StandLocation rootSR, DialogueSprite sprite)
 {
     if (renders.TryGetValue(rootSR, out var pr))
     {
         pr.DestroySpawned();
     }
     else
     {
         renders[rootSR] = pr = new PiecewiseRender();
     }
     pr.Restructure(Target(rootSR), sprite);
     return(pr);
 }
Esempio n. 3
0
 private static IEnumerator _FadeStand(PiecewiseRender pr, float time, bool fadeIn, ICancellee cT, Action done)
 {
     var(t0, d) = fadeIn ? (0, ETime.FRAME_TIME) : (time - ETime.FRAME_TIME, -ETime.FRAME_TIME);
     for (; 0 <= t0 && t0 < time; t0 += d)
     {
         pr.ApplyColor(pr.lastColor.WithA(t0 / time));
         if (cT.Cancelled)
         {
             done();
             yield break;
         }
         yield return(null);
     }
     pr.ApplyColor(pr.lastColor.WithA(fadeIn ? 1 : 0));
     done();
 }