using UnityEngine;
using System.Collections;

public class GerenciadorInicio : MonoBehaviour {

    public Transform[] prefabs;
    public float tempo;
    public float tempoDeEspera;
    public bool instanciarProxima;
    public int indicePrefabs = 0;

    public int somaHerbivoros = 0;
    public int somaCarnivoros = 0;
    public GameObject player;

    void Start()
    {
        instanciarProxima = true;
    }
    void Update()
    {
        if (instanciarProxima == true && indicePrefabs != prefabs.Length)
        {
            Instantiate(prefabs[indicePrefabs], transform.position, transform.rotation);
            instanciarProxima = false;
        }
        else
        {
            if (somaHerbivoros > somaCarnivoros && indicePrefabs == prefabs.Length)
            {

                Application.LoadLevel("Nv1");
                           

            }
            else if (somaCarnivoros > somaHerbivoros && indicePrefabs == prefabs.Length)
            {
                
                Application.LoadLevel("Nv1");
                
                
            }
            else if (somaHerbivoros == somaCarnivoros && somaCarnivoros != 0 && indicePrefabs == prefabs.Length)
            {
               
                Application.LoadLevel("Nv1");
                
            }

        }
    }
    /*public void RandomizarPergunta()
    {
        Esperar();
        int numPrefab = Random.Range(0, prefabs.Length);
        Instantiate(prefabs[numPrefab], transform.position, transform.rotation);
    }*/

    IEnumerator Esperar()
    {
        yield return new WaitForSeconds(2);


    }





}

