Ejemplo n.º 1
0
    public override void Draw()
    {
        switch (which)
        {
        case 0:
            buffer.Fade();
            if (Random.Range(0, 5) == 0)
            {
                int   section = Random.Range(0, 18);
                float h1      = Random.value;
                float h2      = Random.value;
                for (int i = 0; i < buffer.Length; i++)
                {
                    Penrose.TileData t = tiles[i];
                    if (t.section == section)
                    {
                        Color c = Color.HSVToRGB(((t.ring % 4) < 2) ? h1 : h2, 1f, 1f);
                        buffer[i] = c;
                    }
                }
            }
            break;

        case 1:
        {
            var time = Mathf.InverseLerp(0f, 1, Mathf.PingPong(Time.time, 1));

            var color1 = Color.Lerp(colors[0], colors[1], time);
            var color2 = Color.Lerp(colors[1], colors[0], time);

            for (int i = 0; i < buffer.Length; i++)
            {
                Penrose.TileData t = tiles[i];
                int v = ((t.ring % 4) < 2) ?1:0;
                v        ^= ((t.section & 1) == 0) ? 1 : 0;
                v        ^= (((t.section / 6) & 1) == 0) ? 1 : 0;
                buffer[i] = v == 0 ? color1 : color2;
            }
        }
        break;

        case 2:
            ef0.Draw();
            ef1.Draw();
            for (int i = 0; i < buffer.Length; i++)
            {
                Penrose.TileData t = tiles[i];
                int v = ((t.section & 1) == 0) ? 1 : 0;
                v        ^= (((t.section / 6) & 1) == 0) ? 1 : 0;
                buffer[i] = v == 0 ? ef0.buffer[i] : ef1.buffer[i];
            }
            break;
        }
    }
Ejemplo n.º 2
0
 public override void Draw()
 {
     for (int i = 0; i < buffer.Length; i++)
     {
         Penrose.TileData t = tiles[i];
         {
             float angle = t.angle / 180f;
             angle += Time.time * setting.speed;
             Color c = Color.HSVToRGB(angle % 1f, 1f, 1f);
             buffer[i] = c;
         }
     }
 }