Example #1
0
    void Update()
    {
        if (executing)
        {
            camSpeed += cameraAcceleration;

            if (camSpeed > maxSpeed)
            {
                camSpeed = maxSpeed;
            }

            rotY += camSpeed;

            if (shakingUp)
            {
                rotX += shakeFactor;
            }
            else
            {
                rotX -= shakeFactor;
            }

            if (shakingUp && rotX >= maxShakeHeight)
            {
                rotX      = maxShakeHeight;
                shakingUp = false;
            }
            else if (!shakingUp && rotX <= -maxShakeHeight)
            {
                rotX      = -maxShakeHeight;
                shakingUp = true;
            }

            cam.transform.eulerAngles = new Vector3(rotX, rotY, 0);

            if (winAnimation.GetTimePassed() >= winAnimation.durationInSeconds - fadeAnimation.durationInSeconds / 2 && !fadeRunning)
            {
                //fadeAnimationLeft.Begin();
                //fadeAnimationRight.Begin();
                //fadeAnimationFront.Begin();
                //fadeAnimationBack.Begin();
                fadeAnimation.Begin();
                fadeRunning = true;
            }

            currentTime += Time.deltaTime;

            if (currentTime >= timeBetweenBlinks)
            {
                canvas.enabled = !canvas.enabled;
                currentTime    = 0;
            }

            TimeUpdater.running = false;

            if (winAnimation.IsFinished())
            {
                winAnimation.Halt();
                executing      = false;
                canvas.enabled = true;
                RayCastController.level1ObjectsPassed = 0;
                RayCastController.level2ObjectsPassed = 0;
                RayCastController.level3ObjectsPassed = 0;
                titleAnimation.Halt();
                titleAnimation.Begin();
                MoveToNextRoom.MoveToMainRoom();
                TimeUpdater.ResetCounter();
                //SceneManager.LoadScene (SceneManager.GetActiveScene ().name);

                for (int i = 0; i < disabledRoomObjects.Length; i++)
                {
                    disabledRoomObjects [i].Enable();
                }

                soundEmitter1.startClue = false;
                soundEmitter2.startClue = false;
            }
        }

        sendEarthquake.GetComponent <SendCueLocation> ().startClue = executing;
    }