Esempio n. 1
0
    IEnumerator init()
    {
        yield return(new WaitForSeconds(3.0f));

        Screen.SetResolution(1920, 1080, true);
        allGridFountains = GetComponentsInChildren <GridFountain>();

        // create the ordered fountains from this
        orderedFountains[0]  = new GridFountain[46];
        orderedFountains[1]  = new GridFountain[46];
        orderedFountains[2]  = new GridFountain[46];
        orderedFountains[3]  = new GridFountain[46];
        orderedFountains[4]  = new GridFountain[46];
        orderedFountains[5]  = new GridFountain[46];
        orderedFountains[6]  = new GridFountain[44];
        orderedFountains[7]  = new GridFountain[41];
        orderedFountains[8]  = new GridFountain[39];
        orderedFountains[9]  = new GridFountain[35];
        orderedFountains[10] = new GridFountain[33];
        orderedFountains[11] = new GridFountain[29];
        orderedFountains[12] = new GridFountain[26];
        orderedFountains[13] = new GridFountain[22];
        orderedFountains[14] = new GridFountain[19];
        orderedFountains[15] = new GridFountain[16];
        orderedFountains[16] = new GridFountain[12];
        orderedFountains[17] = new GridFountain[9];
        orderedFountains[18] = new GridFountain[5];
        orderedFountains[19] = new GridFountain[1];


        for (int i = 0; i < allGridFountains.Length; i++)
        {
            GridFountain thisFountain = allGridFountains[i];
            //Debug.LogWarning("Trying to add to arr row " + thisFountain.row.ToString() + " col " + thisFountain.col.ToString());
            try
            {
                orderedFountains[thisFountain.row][thisFountain.col] = thisFountain;
            }
            catch
            {
                Debug.Log("broke");
            }
        }

        StartCoroutine(startShow());
    }
Esempio n. 2
0
 void setColors(GridFountain[] fountainsIn, Color[] colors, string colorSelect, Color targetColor, float lerpDuration = 0.0f) // still accepts one color in an array to set it
 {
     for (int i = 0; i < fountainsIn.Length; i++)
     {
         GridFountain thisFountain = fountainsIn[i];
         if (colors.Length == 1)
         {
             // just the one color, set it
             thisFountain.setColor(colors[0], targetColor, lerpDuration);
         }
         else
         {
             if (colorSelect == "sequential")
             {
                 int selectInd = 0;
                 for (int f = 0; f < fountainsIn.Length; f++)
                 {
                     if ((selectInd + 1) > colors.Length)
                     {
                         selectInd = 0;
                     }
                     if (!fountainsIn[f].active)
                     {
                         fountainsIn[f].setColor(colors[selectInd++], targetColor, lerpDuration);
                     }
                 }
                 break;
             }
             else if (colorSelect == "random")
             {
                 // select a color from the list at random and set it to this fountain
                 System.Random rand     = new System.Random();
                 int           colorInd = rand.Next(0, colors.Length - 1);
                 if (!thisFountain.active)
                 {
                     thisFountain.setColor(colors[colorInd], targetColor, lerpDuration);
                 }
             }
         }
     }
 }