Esempio n. 1
0
    public void Reset()
    {
        executing   = true;
        shakingUp   = false;
        camSpeed    = 0;
        rotX        = 0;
        rotY        = 0;
        currentTime = 0;
        fadeRunning = false;
        //winAnimationRenderer.enabled = true;
        //fadeAnimationRenderer.enabled = true;

        winAnimation.Begin();
    }
Esempio n. 2
0
    void Update()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, 9999))
        {
            GameObject obj = hit.transform.gameObject;
            Debug.Log(obj.tag);

            if (obj.tag == "North")
            {
                pointer.eulerAngles = northRotation;
                Debug.Log("North Wall Hit!");
            }
            else if (obj.tag == "South")
            {
                pointer.eulerAngles = southRotation;
                Debug.Log("South Wall Hit!");
            }
            else if (obj.tag == "East")
            {
                pointer.eulerAngles = eastRotation;
                Debug.Log("East Wall Hit!");
            }
            else if (obj.tag == "West")
            {
                pointer.eulerAngles = westRotation;
                Debug.Log("West Wall Hit!");
            }
            else if (obj.tag == "Floor")
            {
                pointer.eulerAngles = floorRotation;
                Debug.Log("Floor Hit!");
            }
            else if (obj.tag == "Ceiling")
            {
                pointer.eulerAngles = ceilingRotation;
                Debug.Log("Ceiling Hit!");
            }

            Vector3 toCamera = (cam.position - hit.point).normalized;
            pointer.position = hit.point + toCamera * offset;

            bool hittingTarget = obj.tag == "Button" || obj.tag == "SoundEmitter" || obj.tag == "StartButton";

            if (!animationPlaying && hittingTarget)
            {
                //pointerPlayer.enabled = true;
                //pointerPlayer.Play ();
                animationPlaying = true;
                wandPointerAnimation.Begin();

                if (obj.tag == "StartButton")
                {
                    startButtonMaterial.SetTexture("_MainTex", pressedButtonTexture);
                    sendStartButton.startClue = true;
                }
            }
            else if (animationPlaying && !hittingTarget)
            {
                //pointerPlayer.Stop ();
                //pointerPlayer.enabled = false;
                animationPlaying = false;
                wandPointerAnimation.Halt();

                startButtonMaterial.SetTexture("_MainTex", unpressedButtonTexture);
                sendStartButton.startClue = false;
            }

            if (wandPointerAnimation.IsFinished())
            {
                int currRoom = MoveToNextRoom.GetCurrentRoom();

                if (obj.tag == "Button" || obj.tag == "SoundEmitter")
                {
                    obj.GetComponent <ChangeRoomObject> ().Disable();

                    if (currRoom == 1)
                    {
                        level1ObjectsPassed++;
                    }
                    else if (currRoom == 2)
                    {
                        level2ObjectsPassed++;
                    }
                    else if (currRoom == 3)
                    {
                        level3ObjectsPassed++;
                    }
                }

                bool room0Passed = currRoom == 0;
                bool room1Passed = currRoom == 1 && level1ObjectsPassed == level1ObjectsTotal;
                bool room2Passed = currRoom == 2 && level2ObjectsPassed == level2ObjectsTotal;
                bool room3Passed = currRoom == 3 && level3ObjectsPassed == level3ObjectsTotal;

                if (room0Passed || room1Passed || room2Passed || room3Passed)
                {
                    ContinueToNextRoom();
                }
            }
        }
    }
Esempio n. 3
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;
    }
Esempio n. 4
0
 void Start()
 {
     titleAnimation.Begin();
 }