コード例 #1
0
    IEnumerator Section1Snake(IEnumerable <IEnumerator> loop)
    {
        foreach (var rest in loop)
        {
            var g = board.FindRandomGraphicWithSize(1, 1);
            //g.SetOpacity(g.opacity + 0.5f, Beat(0.4f));

            //g = board.FindRandomGraphicWithSize(1, 1);
            List <GraphicEntity1> ge = new List <GraphicEntity1>();
            ge.Add(g);
            for (int i = 0; i < 9; i++)   // beats - 1
            {
                foreach (var nextGE in board.FindAdjacentGraphics(g.rect))
                {
                    if (!ge.Contains(nextGE))
                    {
                        ge.Add(nextGE);
                        g = nextGE;
                        break;
                    }
                }
                Debug.Log(g);
            }

            int ij = 0;
            foreach (var gr in ge)
            {
                StartCoroutine(C.WithDelay(() => {
                    var currOpacity = gr.opacity;
                    if (gr.color.RGBEquals(orange))
                    {
                        gr.SetColor(blue.WithAlpha(2f / 3f));
                    }
                    else
                    {
                        gr.SetOpacity(Mathf.Min(1, currOpacity + 2f / 3f));
                    }
                    // what i want - start with new opacity, fade down
                }, Beat(ij * 2)));
                ij++;
            }
            yield return(rest);
        }
    }