Ejemplo n.º 1
0
    // let's
    // build a rect
    // build two rects
    // line and a cross...?

    /*
     * IEnumerator Section2PrebakedShape(IEnumerable<IEnumerator> loop) {
     *  int index = 0;
     *  foreach (var rest in loop) {
     *      switch (index) {
     *          case
     *      }
     *      foreach (var g in board.FindAllGraphicsWithSize(1, 1)) {
     *          Coord pos = g.rect.min;
     *          if (pos) {
     *              g.SetOpacity(0, Beat(0.3f));
     *          }
     *      }
     *
     *      yield return rest;
     *      index++;
     *  }
     * }
     */

    IEnumerator Section2Shape(IEnumerable <IEnumerator> loop)
    {
        foreach (var rest in loop)
        {
            bool[,] collection = new bool[cols, rows];
            for (int i = 0; i < cols; i++)
            {
                for (int j = 0; j < rows; j++)
                {
                    if (Random.value < 0.25)
                    {
                        collection[i, j] = true;
                    }
                    else
                    {
                        collection[i, j] = false;
                    }
                }
            }

            var visibleColor = Random.value > 0.8f ? orange : blue;
            var useSameColor = Random.value > 0.5f;

            board.FindAllGraphicsWithSize(1, 1).ForEach(g => {
                if (!collection[g.rect.min.x, g.rect.min.y])
                {
                    g.SetOpacity(0, Beat(0.3f));
                }
                else
                {
                    if (useSameColor)
                    {
                        g.SetColor(visibleColor);
                    }
                    else
                    {
                        //g.SetColor(Random.value > 0.8f ? orange : blue);
                    }
                }
            });

            //board.FindAllGraphicsWithSize(1,1).ToArray().Shuffle().Take(30).ForEach(g => g.SetOpacity(0, Beat(0.3f)));
            yield return(rest);
        }
    }