Пример #1
0
    IEnumerator Restart()
    {
        yield return(new WaitForSeconds(seconds1));

        aM.Activate(aM.deathVoid);
        gM.diedinVoid = true;

        yield return(new WaitForSeconds(seconds));

        gM.RestartLevel();
        SceneManager.LoadScene("MasterOffice");
    }
Пример #2
0
    IEnumerator Restart()
    {
        yield return(new WaitForSeconds(18.0f));

        aM.Activate(aM.deathOffice);
        gM.diedInOffice = true;

        yield return(new WaitForSeconds(seconds - 18.0f));

        gM.RestartLevel();
        SceneManager.LoadScene("MasterOffice");
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (standStillTimer > timerCap1)
        {
            //print("play audio");
            if (_Audioplayed1 == false)
            {
                Debug.Log("lineplays");
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile1;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed1 = true;
            }
        }
        if (standStillTimer > timerCap2)
        {
            if (_Audioplayed2 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile2;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed2 = true;
            }
        }

        if (standStillTimer > timerCap3)
        {
            if (_Audioplayed3 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile3;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed3 = true;
            }
        }
        if (standStillTimer > timerCap4)
        {
            if (_Audioplayed4 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile4;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed4 = true;
            }
        }
        if (standStillTimer > timerCap5)
        {
            if (_Audioplayed5 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile5;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed5 = true;
            }
        }
        if (standStillTimer > timerCap6)
        {
            if (_Audioplayed6 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile6;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed6 = true;
            }
        }
        if (standStillTimer > timerCap7)
        {
            if (_Audioplayed7 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile7;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed7 = true;
            }
        }
        if (standStillTimer > timerCap8)
        {
            if (_Audioplayed8 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile8;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed8 = true;
            }
        }
        if (standStillTimer > timerCap9)
        {
            if (_Audioplayed9 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile9;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed9 = true;
            }
        }
        if (standStillTimer > timerCap10)
        {
            if (_Audioplayed10 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile10;
                stanley.GetComponent <AudioSource>().Play();
                _Audioplayed10 = true;
            }
        }
        if (standStillTimer > timerCap11)
        {
            if (_Audioplayed11 == false)
            {
                stanley.GetComponent <AudioSource>().Pause();
                stanley.GetComponent <AudioSource>().clip = audioFile11;
                stanley.GetComponent <AudioSource>().Play();
                aM.Activate(aM.deathBroomCloset);
                gM.diedInBroomCloset = true;
                StartCoroutine(Restart());
                _Audioplayed11 = true;
            }
        }
    }
Пример #4
0
    void Update()
    {
        //Ray myRay = new Ray(transform.position, transform.forward);

        Debug.DrawRay(stanley.transform.position, stanley.transform.forward * rayDistance, Color.blue);

        RaycastHit hit;

        if (Physics.Raycast(stanley.transform.position, stanley.transform.forward, out hit, rayDistance))
        {
            //print(hit.transform.tag);
            if (Input.GetMouseButtonDown(0))
            {
                if (hit.transform.tag == "Door" || hit.transform.tag == "Door430" || hit.transform.tag == "Door417" || hit.transform.tag == "Door437" ||
                    hit.transform.tag == "Door416" || hit.transform.tag == "OfficeDoor" || hit.transform.tag == "Door415")     //kate added these doors for the 430 acheivemnt
                {
                    print("hit door");
                    stanleyObject.GetComponent <AudioSource>().PlayOneShot(doorjiggle);
                }
                else
                {
                    clicking();
                    _clickCount++;
                }

                if (hit.transform.tag == "VoidDoor")
                {
                    hit.transform.GetComponentInParent <DoorManager>().openDoor();
                    gM.inVoid = true;
                }

                if (hit.transform.tag == "ClosetDoor" && !bC1.stuckInCloset && !bC2.stuckInCloset && !gM.diedInBroomCloset)
                {
                    if (hit.transform.GetComponentInParent <DoorManager>().open)
                    {
                        hit.transform.GetComponentInParent <DoorManager>().closeDoor();
                    }
                    else
                    {
                        hit.transform.GetComponentInParent <DoorManager>().openDoor();
                    }
                }

                if (hit.transform.tag == "Door430")
                {
                    print("Door 430");
                    doorFourThirtyClicks += 1;
                    if (doorFourThirtyClicks > 4 && aM.fourThirty.activation == 0)
                    {
                        if (stanleyObject.GetComponent <AudioSource>().isPlaying) ///this isnt working to keep it from interrupting, idk why so i have it set to true
                        {
                            aM.fourThirty.activation = 1;
                            doorFourThirtyClicks     = 0;
                            fT.playAudioClipOne();
                            //print("audio should play");
                        }
                        doorFourThirtyClicks = 0;
                    }
                    else if (doorFourThirtyClicks > 19 && aM.fourThirty.activation == 1)
                    {
                        aM.fourThirty.activation = 2;
                        doorFourThirtyClicks     = 0;
                        fT.playAudioClipTwo();
                    }
                    else if (doorFourThirtyClicks > 49 && aM.fourThirty.activation == 2)
                    {
                        aM.fourThirty.activation = 3;
                        doorFourThirtyClicks     = 0;
                        fT.playAudioClipThree();
                    }
                    else if (doorFourThirtyClicks > 4 && aM.fourThirty.activation == 11)
                    {
                        aM.fourThirty.activation = 12;
                        doorFourThirtyClicks     = 0;
                        fT.playAudioClipTwe();
                        aM.Activate(aM.fourThirty);
                    }
                }
                if (hit.transform.tag == "Door417")
                {
                    print("Door 417");
                    doorFourSeventeenClicks += 1;
                    if (doorFourSeventeenClicks > 19 && aM.fourThirty.activation == 3)
                    {
                        aM.fourThirty.activation = 4;
                        doorFourSeventeenClicks  = 0;
                        fT.playAudioClipFour();
                    }
                    if (doorFourSeventeenClicks > 0 && aM.fourThirty.activation == 8)
                    {
                        aM.fourThirty.activation = 9;
                        doorFourSeventeenClicks  = 0;
                        fT.playAudioClipNine();
                    }
                }
                if (hit.transform.tag == "Door437")
                {
                    print("Door 437");
                    doorFourThirtySevenClicks += 1;
                    if (doorFourThirtySevenClicks > 0 && aM.fourThirty.activation == 4)
                    {
                        aM.fourThirty.activation  = 5;
                        doorFourThirtySevenClicks = 0;
                        fT.playAudioClipFive();
                    }

                    if (doorFourThirtySevenClicks > 0 && aM.fourThirty.activation == 6)
                    {
                        aM.fourThirty.activation  = 7;
                        doorFourThirtySevenClicks = 0;
                        fT.playAudioClipSeven();
                    }
                }
                if (hit.transform.tag == "Door415")
                {
                    print("Door 415");
                    doorFourFifteenClicks += 1;
                    if (doorFourFifteenClicks > 9 && aM.fourThirty.activation == 5)
                    {
                        aM.fourThirty.activation = 6;
                        doorFourFifteenClicks    = 0;
                        fT.playAudioClipSix();
                    }
                }
                if (hit.transform.tag == "Door416")
                {
                    print("Door 416");
                    doorFourSixteenClicks += 1;
                    if (doorFourSixteenClicks > 1 && aM.fourThirty.activation == 9)
                    {
                        aM.fourThirty.activation = 10;
                        doorFourSixteenClicks    = 0;
                        fT.playAudioClipTen();
                    }
                }
                if (hit.transform.tag == "Copier")
                {
                    print("Copier");
                    copierClicks += 1;
                    if (copierClicks > 0 && aM.fourThirty.activation == 7)
                    {
                        aM.fourThirty.activation = 8;
                        copierClicks             = 0;
                        fT.playAudioClipEight();
                    }
                    if (copierClicks > 0 && aM.fourThirty.activation == 10)
                    {
                        aM.fourThirty.activation = 11;
                        copierClicks             = 0;
                        fT.playAudioClipEle();
                    }
                }

                else if (hit.transform.tag == "OfficeDoor")
                {
                    hit.transform.GetComponentInParent <DoorManager>().closeDoor();     //this lets stanley stay in his office - kate
                    print("officeDoor");
                    gM.stayOffice = true;
                }
                else
                {
                }
            }
        }

        if (_timer > 30)
        {
            _timer      = 0;
            _clickCount = 0;
        }

        if (_clickCount >= clickCap)
        {
            if (_audioPlayed == false && !stanleyObject.GetComponent <AudioSource>().isPlaying&& !gM.inCloset && !gM.stayOffice && !gM.inVoid)
            {
                stanleyObject.GetComponent <AudioSource>().clip = clickAudioClip;
                stanleyObject.GetComponent <AudioSource>().Play();
                _audioPlayed = true;
            }

            _clickCount = 0;
        }


        _timer = _timer + 1 * Time.deltaTime;
    }