Example #1
0
 void ClearRect(int startx, int starty, int endx, int endy, float fade = 1)
 {
     for (int x = (int)(startx * fade); x < (int)(endx * fade); ++x)
     {
         for (int y = (int)(starty * fade); y < (int)(endy * fade); ++y)
         {
             if (UnityEngine.Random.value < fade)
             {
                 SetPixelFront(' ', x, y, ' ');
             }
             else
             {
                 SetPixelFront(StringScrambler.GetGlitchChar(), x, y, ' ');
             }
         }
     }
 }
Example #2
0
    void DrawTextProgress(string content, int X, int Y, char color, float progress, int progressEdgeLength = 6)
    {
        int intProgress = (int)(Mathf.Clamp01(progress) * content.Length);

        bool drawEdge = true;

        if (progress > 1)
        {
            drawEdge = false;
        }

        int X1 = 0;
        int Y1 = 0;

        for (int i = 0; i < intProgress; ++i)
        {
            if (content[i] == '\n')
            {
                X1 = 0;
                Y1++;
            }
            else
            {
                char zzz = content[i];
                char ccc = color;
                if (Mathf.Abs(i - intProgress) < progressEdgeLength)
                {
                    if (drawEdge && zzz != ' ' && Random.value < .5f)
                    {
                        zzz = StringScrambler.GetGlitchChar();
                        ccc = 'w';
                    }
                }

                if (zzz != ' ')
                {
                    SHGUI.current.SetPixelFront(zzz, X + X1, Y + Y1, ccc);
                }

                X1++;
            }
        }
    }