Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        //Cuando la prueba ha empezado:
        if (startEvent.IsTestStarted())
        {
            if (!firstSpawn)
            {
                //Se crea el primer objetivo
                actualObjetive = manageObjetives.Spawn();
                firstSpawn     = true;
            }

            //Mientras quede tiempo
            if (actualTestTime < testDuration)
            {
                //Se aumenta el tiempo de la prueba y el del objetivo.
                actualTestTime += Time.deltaTime;
            }
            //Termina la prueba
            else if (!finished)
            {
                finished = true;
                startEvent.endTestText();
                Tracker.instance.TrackEvent(Tracker.instance.GenerateTrackerEvent(EventType.SESSION_END));
                Tracker.getInstance().EndTest();
                GameObject.FindObjectOfType <GUIManager>().EndTest();
                Debug.Log("La prueba ha terminado.");

                FindObjectOfType <TestStart>().Proccess();
            }
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        //Prueba
        //timeShoot += Time.deltaTime;

        //Cuando la prueba ha empezado:
        if (startEvent.IsTestStarted())
        {
            if (!firstSpawn)
            {
                //Se spawnea la primera esfera
                RandomTimeSpawn();
                firstSpawn = true;
                // objetiveActive = true;
            }

            //Mientras queden objetivos por salir
            if (actualNumObj < maxNumObj + 1)
            {
                //Si hay objetivo en pantalla y se pulsa
                if ((Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)))
                {
                    Tracker.instance.TrackEvent(new TrackerEvent(EventType.CLICK));
                    if (objetiveActive)
                    {
                        //Prueba
                        //print(timeShoot);

                        actualNumObj++;
                        actualObjetive.SetActive(false);

                        if (actualNumObj < maxNumObj)
                        {
                            objetiveActive = false;
                            RandomTimeSpawn();

                            //Para comprobar la puntuacion
                            Debug.Log("Se han acertado: " + actualNumObj);
                        }
                        //Cuando se han destruido todos los objetivos
                        else
                        {
                            Tracker.instance.TrackEvent(new TrackerEvent(EventType.SESSION_END));
                            Tracker.getInstance().EndTest();
                            startEvent.endTestText();
                            GameObject.FindObjectOfType <GUIManager>().EndTest();
                            GameObject.FindObjectOfType <TestStart>().Proccess();
                            Debug.Log("La prueba ha terminado.");
                        }
                    }
                }
                //Si el probador pulsa pero no hay objetivo se le penaliza

                /*else if (!objetiveActive && (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)))
                 * {
                 *  failClick++;
                 *  Debug.Log("Numero de fallos: " + failClick);
                 * }*/
            }
        }
    }