예제 #1
0
 void Update()
 {
     if (checkGrid)
     {
         if (GameObject.FindGameObjectsWithTag("electron").Length == 0)
         {
             CreateNewGridElts();
             checkGrid = false;
             GridEltBehaviour.FindElements();
             if (ui.comboDisplays > 1)
             {
                 ui.CalculateTimeBonus();
             }
             ui.AddScore();
             ui.ClearComboDisplay();
         }
     }
 }
예제 #2
0
    void Start()
    {
        GridEltBehaviour[] powersAndDisplays = GameObject.FindObjectsOfType <GridEltBehaviour>();
        int powerscnt   = 0;
        int displayscnt = 0;

        for (int i = 0; i < 20; i++)
        {
            if (powersAndDisplays[i].isPower)
            {
                powers[powerscnt]    = powersAndDisplays[i];
                powers[powerscnt].ui = ui;
                powerscnt++;
            }
            if (powersAndDisplays[i].isDisplay)
            {
                displays[displayscnt]    = powersAndDisplays[i];
                displays[displayscnt].ui = ui;
                displayscnt++;
            }
        }
        for (int i = 0; i < 7; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                GameObject elt = (GameObject)Instantiate(wires[Random.Range(0, 4)], new Vector3(i - 2.5f, j - 2), Quaternion.identity);
                elt.transform.Rotate(0f, 0f, 90f * Random.Range(0, 4), Space.Self);
                GridEltBehaviour eltscript = elt.GetComponent <GridEltBehaviour>();
                grid[i, j]   = eltscript;
                eltscript.ui = ui;
                StartCoroutine(MoveToPosition(j - 4, elt.transform));
            }
        }
        checkGrid = false;
        GridEltBehaviour.FindElements();
    }