Esempio n. 1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F) && !hasPickedUp && flashLightCollider.IsCollidingWithPlayer())
        {
            hasPickedUp = true;
            audioPlayer.Play();
            playerMessage.text = "";
            colliderObject.SetActive(false);
            transform.position = new Vector3(100f, 0f, 0f);
            Invoke("ShowFlashlightHelp", 2f);

            if (screamCollider.HasCollided())
            {
                chainsaw.PlayChainsawAudioAfter(5f);
                Destroy(blockingStretcher);
            }
        }

        if (Input.GetKeyDown(KeyCode.E) && hasPickedUp)
        {
            if (lampLight.activeSelf)
            {
                audioPlayer.clip = flashLightOff;
            }
            else
            {
                audioPlayer.clip = flashLightOn;
            }

            audioPlayer.Play();
            lampLight.SetActive(!lampLight.activeSelf);
        }
    }
Esempio n. 2
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.tag == "Player" && screamPlayer.GetComponent <AudioSource>().isPlaying)
        {
            screamPlayer.StopScreams();
            GameObject.FindGameObjectWithTag("MainCamera").GetComponent <AudioSource>().Play();

            if (!hasCollided)
            {
                hasCollided = true;
                flashlightObject.SetActive(false);
            }

            if (flashlight.HasPickedUp())
            {
                Destroy(blockingStretcher);
                chainsaw.PlayChainsawAudioAfter(5f);
            }
        }
    }