Exemple #1
0
    private void Awake()
    {
        if (instancia != null)
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(this.gameObject);
        instancia = this;
    }
Exemple #2
0
    void Start()
    {
        //IniciarCalibracion();
        EmpezarCarrera();
        //para testing
        //PosCamionesCarrera[0].x+=100;
        //PosCamionesCarrera[1].x+=100;
        StartCoroutine(Play());
        pantallaCarga = FindObjectOfType <PantallaDeCarga>();
        mg            = FindObjectOfType <ManagerGameplay>();

        if (mg != null)
        {
            switch (mg.GetDificultad())
            {
            case ManagerGameplay.Dificultad.Easy:
                for (int i = 0; i < objetosApagarFacil.Length; i++)
                {
                    if (objetosApagarFacil[i] != null)
                    {
                        objetosApagarFacil[i].SetActive(false);
                    }
                }
                break;

            case ManagerGameplay.Dificultad.Normal:
                for (int i = 0; i < objetosApagarNormal.Length; i++)
                {
                    if (objetosApagarNormal[i] != null)
                    {
                        objetosApagarNormal[i].SetActive(false);
                    }
                }
                break;

            case ManagerGameplay.Dificultad.Dificil:
                for (int i = 0; i < objetosApagarDificil.Length; i++)
                {
                    if (objetosApagarDificil[i] != null)
                    {
                        objetosApagarDificil[i].SetActive(false);
                    }
                }
                break;
            }
        }

        for (int i = 0; i < p2Objects.Length; i++)
        {
            if (p2Objects[i] != null)
            {
                p2Objects[i].SetActive(false);
            }
        }


       #if UNITY_EDITOR
        for (int i = 0; i < p2Objects.Length; i++)
        {
            if (p2Objects[i] != null)
            {
                p2Objects[i].SetActive(true);
            }
        }
       #elif UNITY_ANDROID || UNITY_IOS
        for (int i = 0; i < p2Objects.Length; i++)
        {
            if (p2Objects[i] != null)
            {
                p2Objects[i].SetActive(false);
            }
        }

        camp1.rect        = new Rect(0f, 0f, 1f, 1f);
        camp1Entrega.rect = new Rect(0f, 0f, 1f, 1f);
       #endif
    }
Exemple #3
0
 void Start()
 {
     managerGameplay = FindObjectOfType <ManagerGameplay>();
     pantallaCarga   = FindObjectOfType <PantallaDeCarga>();
 }