Ejemplo n.º 1
0
    public void Update()
    {
        if (slotChecked == StaticCheckGame.getRoundNumber())
        {
            if (StaticCheckGame.getGameEnded() == true)
            {
                if (transform.name.Contains("Fruit"))
                {
                    for (int i = 0; i < transform.childCount; i++)
                    {
                        if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_0"))
                        {
                            StaticCheckGame.setGameWinFalse();
                            slotChecked++;
                            StaticCheckGame.incSlotsChecked();
                            return;
                        }
                    }
                }
                else if (transform.name.Contains("Veg"))
                {
                    for (int i = 0; i < transform.childCount; i++)
                    {
                        if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_1"))
                        {
                            StaticCheckGame.setGameWinFalse();
                            slotChecked++;
                            StaticCheckGame.incSlotsChecked();
                            return;
                        }
                    }
                }

                else if (transform.name.Contains("Grains"))
                {
                    for (int i = 0; i < transform.childCount; i++)
                    {
                        if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_2"))
                        {
                            StaticCheckGame.setGameWinFalse();
                            slotChecked++;
                            StaticCheckGame.incSlotsChecked();
                            return;
                        }
                    }
                }

                else if (transform.name.Contains("ProteinA"))
                {
                    for (int i = 0; i < transform.childCount; i++)
                    {
                        if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_3"))
                        {
                            StaticCheckGame.setGameWinFalse();
                            slotChecked++;
                            StaticCheckGame.incSlotsChecked();
                            return;
                        }
                    }
                }

                else if (transform.name.Contains("ProteinV"))
                {
                    for (int i = 0; i < transform.childCount; i++)
                    {
                        if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("_4"))
                        {
                            StaticCheckGame.setGameWinFalse();
                            slotChecked++;
                            StaticCheckGame.incSlotsChecked();
                            return;
                        }
                    }
                }
                slotChecked++;
                StaticCheckGame.incSlotsChecked();
            }
        }
    }
Ejemplo n.º 2
0
    public void Update()
    {
        string type = "";

        if (slotChecked == StaticCheckGame.getRoundNumber())
        {
            if (StaticCheckGame.getGameEnded() == true)
            {
                if (transform.name.Contains("Drinks"))
                {
                    for (int i = 0; i < transform.childCount; i++)
                    {
                        if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("drink"))
                        {
                            StaticCheckGame.setGameWinFalse();
                            slotChecked++;
                            StaticCheckGame.incSlotsChecked();
                            return;
                        }
                    }
                }
                if (transform.name.Contains("Bottom"))
                {
                    for (int i = 0; i < transform.childCount; i++)
                    {
                        if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("vegetable") &&
                            !transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("fruit"))
                        {
                            StaticCheckGame.setGameWinFalse();
                            slotChecked++;
                            StaticCheckGame.incSlotsChecked();
                            return;
                        }
                    }
                }
                if (transform.name.Contains("Panel"))
                {
                    for (int i = 0; i < transform.childCount; i++)
                    {
                        if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("protein") &&
                            !transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("lact"))
                        {
                            StaticCheckGame.setGameWinFalse();
                            slotChecked++;
                            StaticCheckGame.incSlotsChecked();
                            return;
                        }
                    }
                }
                for (int i = 0; i < transform.childCount; i++)
                {
                    if (i == 0)
                    {
                        if (transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("protein"))
                        {
                            type = "protein";
                        }
                        else if (transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("vegetable"))
                        {
                            type = "vegetable";
                        }
                        else if (transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("fruit"))
                        {
                            type = "fruit";
                        }
                        else if (transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains("lact"))
                        {
                            type = "lact";
                        }
                    }
                    if (i > 0)
                    {
                        if (!transform.GetChild(i).gameObject.GetComponent <Image> ().sprite.name.Contains(type))
                        {
                            StaticCheckGame.setGameWinFalse();
                            slotChecked++;
                            StaticCheckGame.incSlotsChecked();
                            return;
                        }
                    }
                }
                slotChecked++;
                StaticCheckGame.incSlotsChecked();
            }
        }
    }