Exemple #1
0
    void changeObjective(bool der)
    {
        print((-5) % 4);
        bool encontrado = false;
        int  i          = 0;

        while (i < allSwitchs.Length)
        {
            //print((allSwitchs[i].order) % allSwitchs.Length);
            if (!encontrado && der && (actual.order + 1) % allSwitchs.Length == (allSwitchs[i].order))
            {
                encontrado = true;
                actual     = allSwitchs[i];
                actual.changeColor(false);
            }
            else if (!encontrado && !der && actual.order == 0 && allSwitchs[i].order == allSwitchs.Length - 1)
            {
                encontrado = true;
                actual     = allSwitchs[i];
                actual.changeColor(false);
            }
            else if (!encontrado && !der && Mathf.Abs(actual.order - 1) % allSwitchs.Length == (allSwitchs[i].order))
            {
                encontrado = true;
                actual     = allSwitchs[i];
                actual.changeColor(false);
            }
            else
            {
                allSwitchs[i].changeColor(true);
            }
            i++;
        }
    }
Exemple #2
0
 // Start is called before the first frame update
 void Start()
 {
     allSwitchs = GameObject.FindObjectsOfType <Switchable>();
     actual     = allSwitchs[0];
     actual.changeColor(false);
 }