void Update()
    {
        // Bloquea sistema de eventos si el parallax está en movimiento.
        if (eventSystem != null)
        {
            if (eventSystem.activeSelf && parallax.isMoving)
            {
                eventSystem.SetActive(false);
            }
            if (!eventSystem.activeSelf && !parallax.isMoving)
            {
                eventSystem.SetActive(true);
            }
        }

        // Cuando el parallax deja de moverse, activa el nivel.
        if (prepareStart && !parallax.isMoving)
        {
            experimentManager.ActivateCursors();
            inExperiment = true;
            prepareStart = false;
        }

        // Tecla ESC configurada para que los experimentadores interumpan el experimento.
        if (inExperiment)
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                this.EndExperiment();
            }
        }

        // Si la limpieza del cofre ha terminado, termina juego.
        if (clearing)
        {
            if (!chestClearerScript.isRunning)
            {
                this.EndGame();
                clearing = false;
                chestClearerScript.StopClear();
            }
        }
    }
    void Start()
    {
        // Adquiere referencias a componentes.
        parallax           = GetComponent <Parallax>();
        jukebox            = GetComponent <Jukebox>();
        chestClearerScript = chestClearer.GetComponent <ChestClear>();

        // Carga configuración de volumen de las preferencias de usuario.
        int musicVolume = PlayerPrefs.GetInt("Volume", -1);

        if (musicVolume == -1)
        {
            musicVolume = 100;
        }
        if (jukebox != null)
        {
            jukebox.volume = (float)musicVolume;
        }

        if (mainMenu != null)
        {
            mainMenuScript = mainMenu.GetComponent <MainMenu>();
        }

        experimentManager = experiment.GetComponent <ExperimentManager>();

        // Inicia automáticamente el experimento en la configuración debug.
        // Usado en escena de depuración "Experiment".
        if (debug)
        {
            this.StartExperiment(3, 2, 30, 30, true);
            experimentManager.ActivateCursors();
            currentRound = 1;
        }

        prepareStart     = false;
        inExperiment     = false;
        clearing         = false;
        totalScoreA      = 0;
        totalScoreB      = 0;
        totalScoreCommon = 0;
    }