Beispiel #1
0
    public void checkVoice(CrystalController.Colors color, bool colorWord)
    {
        if (colorWord)
        {
            foreach (Transform child in activeCrystals.transform)
            {
                if (!child.gameObject.GetComponent <CrystalController>().GUICrystal)
                {
                    child.gameObject.GetComponent <CrystalController>().isOn = false;
                }
            }
            if (!showingPattern)
            {
                if (color == patronList[currentPatron - 1][contChecking].crystalColor)
                {
                    foreach (Transform child in activeCrystals.transform)
                    {
                        if (child.gameObject.GetComponent <CrystalController>().crystalColor == color)
                        {
                            child.gameObject.GetComponent <CrystalController>().changeCrystal(true, patronList[currentPatron - 1][contChecking]);
                        }
                    }

                    GUICrystals[contChecking].gameObject.GetComponent <CrystalController>().changeCrystal(true, patronList[currentPatron - 1][contChecking]);


                    contChecking++;

                    messageInScreen.GetComponent <ScreenMessage>().goodOrBad(true);

                    if (contChecking > patronList[currentPatron - 1].Length - 1)
                    {
                        //Muy bien, ganaste
                        Debug.Log("Ganaste");
                        GameManager.GetInstance().increaseDifficulty();
                        messageInScreen.GetComponent <ScreenMessage>().winScreen();
                    }
                }
                else
                {
                    messageInScreen.GetComponent <ScreenMessage>().goodOrBad(false);

                    //Decir que le quedó mal
                    Debug.Log("Perdiste");

                    foreach (Transform child in activeCrystals.transform)
                    {
                        if (child.gameObject.GetComponent <CrystalController>().crystalColor == color)
                        {
                            child.gameObject.GetComponent <CrystalController>().lostPattern();
                        }
                        else
                        {
                            child.gameObject.GetComponent <CrystalController>().isOn = false;
                        }
                    }
                }
            }
        }
        else
        {
        }
    }
Beispiel #2
0
    private void getColor(string color)
    {
        foreach (Crystal crystal in patternController.crystalList)
        {
            if (color == crystal.crystalColor.ToString())
            {
                colorWord = true;
            }
        }

        switch (color)
        {
        case "BLUE":
            enumColor = CrystalController.Colors.BLUE;
            break;

        case "GREEN":
            enumColor = CrystalController.Colors.GREEN;
            break;

        case "YELLOW":
            enumColor = CrystalController.Colors.YELLOW;
            break;

        case "PINK":
            enumColor = CrystalController.Colors.PINK;
            break;

        case "BROWN":
            enumColor = CrystalController.Colors.BROWN;
            break;

        case "ORANGE":
            enumColor = CrystalController.Colors.ORANGE;
            break;

        case "LIME":
            enumColor = CrystalController.Colors.LIME;
            break;

        case "SILVER":
            enumColor = CrystalController.Colors.SILVER;
            break;

        case "MAGENTA":
            enumColor = CrystalController.Colors.MAGENTA;
            break;

        case "WHITE":
            enumColor = CrystalController.Colors.WHITE;
            break;

        case "TURQUOISE":
            enumColor = CrystalController.Colors.TURQUOISE;
            break;

        case "BLACK":
            enumColor = CrystalController.Colors.BLACK;
            break;

        case "INDIGO":
            enumColor = CrystalController.Colors.INDIGO;
            break;

        case "RED":
            enumColor = CrystalController.Colors.RED;
            break;

        case "FUCHSIA":
            enumColor = CrystalController.Colors.FUCHSIA;
            break;
        }

        patternController.checkVoice(enumColor, colorWord);
    }