Exemplo n.º 1
0
    void Update()
    {
        if (no == 1)
        {
            Scene1.SetActive(true);
            Scene2.SetActive(false);
            Scene3.SetActive(false);
            Scene4.SetActive(false);
            Scene5.SetActive(false);
            Scene6.SetActive(false);
            Scene7.SetActive(false);
            Scene8.SetActive(false);
            Scene9.SetActive(false);

            Ingredient1.SetActive(true);
            Ingredient2.SetActive(false);
            Ingredient3.SetActive(false);
            Ingredient4.SetActive(false);
            Ingredient5.SetActive(false);
            Ingredient6.SetActive(false);
            Ingredient7.SetActive(false);
            Ingredient8.SetActive(false);
            Ingredient9.SetActive(false);

            FoodInfo1.SetActive(true);
            FoodInfo2.SetActive(false);
            FoodInfo3.SetActive(false);
            FoodInfo4.SetActive(false);
            FoodInfo5.SetActive(false);
            FoodInfo6.SetActive(false);
            FoodInfo7.SetActive(false);
            FoodInfo8.SetActive(false);
            FoodInfo9.SetActive(false);
        }

        if (no == 2)
        {
            Scene1.SetActive(false);
            Scene2.SetActive(true);
            Scene3.SetActive(false);
            Scene4.SetActive(false);
            Scene5.SetActive(false);
            Scene6.SetActive(false);
            Scene7.SetActive(false);
            Scene8.SetActive(false);
            Scene9.SetActive(false);

            Ingredient1.SetActive(false);
            Ingredient2.SetActive(true);
            Ingredient3.SetActive(false);
            Ingredient4.SetActive(false);
            Ingredient5.SetActive(false);
            Ingredient6.SetActive(false);
            Ingredient7.SetActive(false);
            Ingredient8.SetActive(false);
            Ingredient9.SetActive(false);

            FoodInfo1.SetActive(false);
            FoodInfo2.SetActive(true);
            FoodInfo3.SetActive(false);
            FoodInfo4.SetActive(false);
            FoodInfo5.SetActive(false);
            FoodInfo6.SetActive(false);
            FoodInfo7.SetActive(false);
            FoodInfo8.SetActive(false);
            FoodInfo9.SetActive(false);
        }

        if (no == 3)
        {
            Scene1.SetActive(false);
            Scene2.SetActive(false);
            Scene3.SetActive(true);
            Scene4.SetActive(false);
            Scene5.SetActive(false);
            Scene6.SetActive(false);
            Scene7.SetActive(false);
            Scene8.SetActive(false);
            Scene9.SetActive(false);

            Ingredient1.SetActive(false);
            Ingredient2.SetActive(false);
            Ingredient3.SetActive(true);
            Ingredient4.SetActive(false);
            Ingredient5.SetActive(false);
            Ingredient6.SetActive(false);
            Ingredient7.SetActive(false);
            Ingredient8.SetActive(false);
            Ingredient9.SetActive(false);

            FoodInfo1.SetActive(false);
            FoodInfo2.SetActive(false);
            FoodInfo3.SetActive(true);
            FoodInfo4.SetActive(false);
            FoodInfo5.SetActive(false);
            FoodInfo6.SetActive(false);
            FoodInfo7.SetActive(false);
            FoodInfo8.SetActive(false);
            FoodInfo9.SetActive(false);
        }

        if (no == 4)
        {
            Scene1.SetActive(false);
            Scene2.SetActive(false);
            Scene3.SetActive(false);
            Scene4.SetActive(true);
            Scene5.SetActive(false);
            Scene6.SetActive(false);
            Scene7.SetActive(false);
            Scene8.SetActive(false);
            Scene9.SetActive(false);

            Ingredient1.SetActive(false);
            Ingredient2.SetActive(false);
            Ingredient3.SetActive(false);
            Ingredient4.SetActive(true);
            Ingredient5.SetActive(false);
            Ingredient6.SetActive(false);
            Ingredient7.SetActive(false);
            Ingredient8.SetActive(false);
            Ingredient9.SetActive(false);

            FoodInfo1.SetActive(false);
            FoodInfo2.SetActive(false);
            FoodInfo3.SetActive(false);
            FoodInfo4.SetActive(true);
            FoodInfo5.SetActive(false);
            FoodInfo6.SetActive(false);
            FoodInfo7.SetActive(false);
            FoodInfo8.SetActive(false);
            FoodInfo9.SetActive(false);
        }

        if (no == 5)
        {
            Scene1.SetActive(false);
            Scene2.SetActive(false);
            Scene3.SetActive(false);
            Scene4.SetActive(false);
            Scene5.SetActive(true);
            Scene6.SetActive(false);
            Scene7.SetActive(false);
            Scene8.SetActive(false);
            Scene9.SetActive(false);

            Ingredient1.SetActive(false);
            Ingredient2.SetActive(false);
            Ingredient3.SetActive(false);
            Ingredient4.SetActive(false);
            Ingredient5.SetActive(true);
            Ingredient6.SetActive(false);
            Ingredient7.SetActive(false);
            Ingredient8.SetActive(false);
            Ingredient9.SetActive(false);

            FoodInfo1.SetActive(false);
            FoodInfo2.SetActive(false);
            FoodInfo3.SetActive(false);
            FoodInfo4.SetActive(false);
            FoodInfo5.SetActive(true);
            FoodInfo6.SetActive(false);
            FoodInfo7.SetActive(false);
            FoodInfo8.SetActive(false);
            FoodInfo9.SetActive(false);
        }

        if (no == 6)
        {
            Scene1.SetActive(false);
            Scene2.SetActive(false);
            Scene3.SetActive(false);
            Scene4.SetActive(false);
            Scene5.SetActive(false);
            Scene6.SetActive(true);
            Scene7.SetActive(false);
            Scene8.SetActive(false);
            Scene9.SetActive(false);

            Ingredient1.SetActive(false);
            Ingredient2.SetActive(false);
            Ingredient3.SetActive(false);
            Ingredient4.SetActive(false);
            Ingredient5.SetActive(false);
            Ingredient6.SetActive(true);
            Ingredient7.SetActive(false);
            Ingredient8.SetActive(false);
            Ingredient9.SetActive(false);

            FoodInfo1.SetActive(false);
            FoodInfo2.SetActive(false);
            FoodInfo3.SetActive(false);
            FoodInfo4.SetActive(false);
            FoodInfo5.SetActive(false);
            FoodInfo6.SetActive(true);
            FoodInfo7.SetActive(false);
            FoodInfo8.SetActive(false);
            FoodInfo9.SetActive(false);
        }

        if (no == 7)
        {
            Scene1.SetActive(false);
            Scene2.SetActive(false);
            Scene3.SetActive(false);
            Scene4.SetActive(false);
            Scene5.SetActive(false);
            Scene6.SetActive(false);
            Scene7.SetActive(true);
            Scene8.SetActive(false);
            Scene9.SetActive(false);

            Ingredient1.SetActive(false);
            Ingredient2.SetActive(false);
            Ingredient3.SetActive(false);
            Ingredient4.SetActive(false);
            Ingredient5.SetActive(false);
            Ingredient6.SetActive(false);
            Ingredient7.SetActive(true);
            Ingredient8.SetActive(false);
            Ingredient9.SetActive(false);

            FoodInfo1.SetActive(false);
            FoodInfo2.SetActive(false);
            FoodInfo3.SetActive(false);
            FoodInfo4.SetActive(false);
            FoodInfo5.SetActive(false);
            FoodInfo6.SetActive(false);
            FoodInfo7.SetActive(true);
            FoodInfo8.SetActive(false);
            FoodInfo9.SetActive(false);
        }

        if (no == 8)
        {
            Scene1.SetActive(false);
            Scene2.SetActive(false);
            Scene3.SetActive(false);
            Scene4.SetActive(false);
            Scene5.SetActive(false);
            Scene6.SetActive(false);
            Scene7.SetActive(false);
            Scene8.SetActive(true);
            Scene9.SetActive(false);

            Ingredient1.SetActive(false);
            Ingredient2.SetActive(false);
            Ingredient3.SetActive(false);
            Ingredient4.SetActive(false);
            Ingredient5.SetActive(false);
            Ingredient6.SetActive(false);
            Ingredient7.SetActive(false);
            Ingredient8.SetActive(true);
            Ingredient9.SetActive(false);

            FoodInfo1.SetActive(false);
            FoodInfo2.SetActive(false);
            FoodInfo3.SetActive(false);
            FoodInfo4.SetActive(false);
            FoodInfo5.SetActive(false);
            FoodInfo6.SetActive(false);
            FoodInfo7.SetActive(false);
            FoodInfo8.SetActive(true);
            FoodInfo9.SetActive(false);
        }

        if (no == 9)
        {
            Scene1.SetActive(false);
            Scene2.SetActive(false);
            Scene3.SetActive(false);
            Scene4.SetActive(false);
            Scene5.SetActive(false);
            Scene6.SetActive(false);
            Scene7.SetActive(false);
            Scene8.SetActive(false);
            Scene9.SetActive(true);

            Ingredient1.SetActive(false);
            Ingredient2.SetActive(false);
            Ingredient3.SetActive(false);
            Ingredient4.SetActive(false);
            Ingredient5.SetActive(false);
            Ingredient6.SetActive(false);
            Ingredient7.SetActive(false);
            Ingredient8.SetActive(false);
            Ingredient9.SetActive(true);

            FoodInfo1.SetActive(false);
            FoodInfo2.SetActive(false);
            FoodInfo3.SetActive(false);
            FoodInfo4.SetActive(false);
            FoodInfo5.SetActive(false);
            FoodInfo6.SetActive(false);
            FoodInfo7.SetActive(false);
            FoodInfo8.SetActive(false);
            FoodInfo9.SetActive(true);
        }
    }
    public void SpawnEnemys()
    {
        if (gameController.life.Count > 4)
        {
            for (int i = 0; i < gameController.type.Count; i++)
            {
                if (i > 2)
                {
                    gameController.life.RemoveAt(i);
                    gameController.type.RemoveAt(i);
                }
            }
        }
        audio.Play();
        player.StartPlayer();
        countR = 0;
        countB = 0;
        countP = 0;
        countG = 0;
        if (inventario.level == 1)
        {
            Scene1.SetActive(true);
        }
        else if (inventario.level == 2)
        {
            Scene2.SetActive(true);
        }
        else
        {
            Scene3.SetActive(true);
        }
        for (int i = 0; i < gameController.type.Count; i++)
        {
            if (gameController.type[i] == 1)
            {
                GameObject newGnome = Instantiate(fireGnome, new Vector3(SpawnPoints[i].transform.position.x, SpawnPoints[i].transform.position.y, SpawnPoints[i].transform.position.z), Quaternion.Euler(0, 6f, 0)) as GameObject;
                newGnome.GetComponent <CombatEnemy>().life = gameController.life[i];
                countR++;
            }
            if (gameController.type[i] == 2)
            {
                GameObject newGnome = Instantiate(iceGnome, new Vector3(SpawnPoints[i].transform.position.x, SpawnPoints[i].transform.position.y, SpawnPoints[i].transform.position.z), Quaternion.Euler(0, 6f, 0)) as GameObject;
                newGnome.GetComponent <CombatEnemy>().life = gameController.life[i];
                countB++;
            }
            if (gameController.type[i] == 3)
            {
                GameObject newGnome = Instantiate(earthGnome, new Vector3(SpawnPoints[i].transform.position.x, SpawnPoints[i].transform.position.y, SpawnPoints[i].transform.position.z), Quaternion.Euler(0, 6f, 0)) as GameObject;
                newGnome.GetComponent <CombatEnemy>().life = gameController.life[i];
                countP++;
            }
            if (gameController.type[i] == 4)
            {
                GameObject newGnome = Instantiate(physicalGnome, new Vector3(SpawnPoints[i].transform.position.x, SpawnPoints[i].transform.position.y, SpawnPoints[i].transform.position.z), Quaternion.Euler(0, 6f, 0)) as GameObject;
                newGnome.GetComponent <CombatEnemy>().life = gameController.life[i];
                countG++;
            }
            if (gameController.type[i] == 5)
            {
                GameObject newGnome = Instantiate(boss, new Vector3(SpawnPoints[i].transform.position.x, SpawnPoints[i].transform.position.y, SpawnPoints[i].transform.position.z), Quaternion.Euler(0, 6f, 0)) as GameObject;
                newGnome.GetComponent <CombatEnemy>().life = gameController.life[i];
            }
        }

        Enemys = GameObject.FindGameObjectsWithTag("EnemyCombat");
    }