// Update is called once per frame
    void Update()
    {
        if (checking1 == true)
        {
            if (check1.GetComponent <BoxTrigger>().GetState())
            {
                if (RandOrScript == 0)
                {
                    Guard1_.SetSeq(FinalMessage);
                }
                else
                {
                    Guard1_.PlaySound(SCRIPTED[Random.Range(0, SCRIPTED.Length)]);
                }

                Guard2_.SetPath(path1);
                D1_.SetPath(path1);
                Guard2_.AnimTrigger(1, true);
                Sci1_.AnimTrigger(2, true);
                Sci1_.SetPath(path2);
                checking1 = false;
                checking2 = true;
            }
        }

        if (checking2 == true)
        {
            if (check2.GetComponent <BoxTrigger>().GetState())
            {
                Jan_.AnimTrigger(2, true);
                Jan_.SetPath(path3);
                Sci2_.PlaySound(Scientistdiag);
                checking2 = false;
            }
        }
    }
Пример #2
0
    void IntroUpdate()
    {
        if (ActiveTimer)
        {
            Timer -= Time.deltaTime;
        }
        if (runningAway)
        {
            RunawayTimer -= Time.deltaTime;
        }

        if (RunawayTimer <= 0.0f && runningAway == true)
        {
            if (EventState == -5)
            {
                Escape5();
            }
            if (EventState == -4)
            {
                Escape4();
            }
            if (EventState == -3)
            {
                Escape3();
            }
            if (EventState == -2)
            {
                Escape2();
            }
            if (EventState == -1)
            {
                Escape1();
            }
        }

        if (Timer <= 0.0f && Start == false)
        {
            Timer = Timer1;
            Guard1_con.PlaySound(Dialogs[0], true);

            if (grabbed == false)
            {
                SCP_UI.instance.ShowTutorial("tutograb");
            }
            Start = true;
        }

        if (grabbed == false && Item == null)
        {
            SCP_UI.instance.ShowTutorial("tutoinv1");
            grabbed = true;
        }



        if (Timer <= 0.0f && StopTimer == false && Start == true)
        {
            if (EventState == -13)
            {
                EVRefuse3();
            }
            if (EventState == -12)
            {
                EVRefuse2();
            }
            if (EventState == -11)
            {
                EVRefuse1();
            }


            if (EventState == 3)
            {
                Scene3();
                StopTimer = true;
            }
            if (EventState == 2)
            {
                Scene2();
            }
            if (EventState == 1)
            {
                Scene1_5();
            }

            if (EventState == 0)
            {
                Scene1();
            }
        }



        if (ActiveTimer2)
        {
            TimerSecondary -= Time.deltaTime;
        }
        if (TimerSecondary <= 0.0f && StopTimer2 == false)
        {
            if (EventState2 == 2)
            {
                AsyncScene_2();
            }
            if (EventState2 == 1)
            {
                AsyncScene_1();
            }
        }



        if (Check1 == true)
        {
            if (Trigger1.GetComponent <BoxTrigger>().GetState())
            {
                Check1      = false;
                ActiveTimer = true;
                Scene1_6();
            }
        }

        if (Check3 == true)
        {
            if (Trigger3.GetComponent <BoxTrigger>().GetState())
            {
                if (!back1)
                {
                    Guard1_con.PlaySound(Dialogs[5], true);
                    back1 = true;
                }
                Guard1_con.ResumePath();
                Guard1_con.StopRota();

                Guard1_con.AnimTrigger(1, false);

                Guard1_con.StopLookAt();
                Guard2_con.ResumePath();

                LastState = EventState;

                Check3      = false;
                Check2      = true;
                ActiveTimer = true;
                runningAway = false;
                EventState  = 3;
            }
        }

        if (Check2 == true)
        {
            if (!Trigger2.GetComponent <BoxTrigger>().GetState() && EventState != -1)
            {
                Guard1_con.StopSound();
                Guard2_con.StopSound();
                EventState = LastState;
                if (!back1)
                {
                    RunawayTimer = 6;
                    Guard1_con.PlaySound(Dialogs[2], true, true);
                }

                if (Conver != -1)
                {
                    StopCoroutine(co);
                    Conver = -1;
                }

                Guard1_con.SetLookAt(playerHead);
                ActiveTimer  = false;
                ActiveTimer2 = false;
                runningAway  = true;

                Guard1_con.SetRota(Player.transform);
                Guard2_con.SetLookAt(playerHead);
                Guard2_con.PausePath();
                Guard1_con.PausePath();

                Check2 = false;
                Check3 = true;
            }
        }

        if (Check4 == true)
        {
            if (Trigger4.GetComponent <BoxTrigger>().GetState())
            {
                Guard1_con.StopPursuit();
                Guard1_con.PlaySound(Gunshot);
                Player.GetComponent <Player_Control>().Death(0);
                GameController.instance.deathmsg = Localization.GetString("deathStrings", "death_intro");
                Check4      = false;
                Check3      = false;
                Check2      = false;
                runningAway = false;
                Guard1_con.AnimTrigger(-1, true);
            }
        }
    }
    // Update is called once per frame
    void LateUpdate()
    {
        if (eventstat == 0)
        {
            d2_.AnimTrigger(2, true);
            if (tri1.GetComponent <BoxTrigger>().GetState())
            {
                eventstat = 1;
                Debug.Log("Door 2 switch");
                door2.GetComponent <Object_Door>().DoorSwitch();
                d1_.SetLookAt(Camera.main.transform);
                Timer       = Timer1;
                ActiveTimer = true;
            }
        }

        if (check2 == true)
        {
            if (tri2.GetComponent <BoxTrigger>().GetState())
            {
                Debug.Log("Closing door");
                door1.GetComponent <Object_Door>().DoorSwitch();
                sci_.PlaySound(Dialogs[1], true);
                sci_.AnimTrigger(-6);
                check2       = false;
                Timer        = 4f;
                eventstat    = 5;
                ActiveTimer  = true;
                ActiveRefuse = false;
                StopTimer    = false;
                guard_.StopRota();
                d1_.StopLookAt();
                d2_.StopLookAt();
            }
        }

        if (check3 == true)
        {
            if (tri3.GetComponent <BoxTrigger>().GetState())
            {
                guard_.SetLookAt(objPlayer.transform);
                guard_.PlaySound(guardExit[Random.Range(0, guardExit.Length)]);
                check3 = false;
            }
        }



        if (ActiveTimer)
        {
            Timer -= Time.deltaTime;
        }
        if (ActiveRefuse)
        {
            refuseTimer -= Time.deltaTime;

            if (refuseTimer <= 0)
            {
                switch (refusestat)
                {
                case 0:
                {
                    sci_.PlaySound(Refuse[0], true);
                    refusestat  = 1;
                    refuseTimer = refuseTimer2;
                    guard_.SetRota(objPlayer.transform);
                    d2_.SetLookAt(GameController.instance.playercache.DefHead);
                    break;
                }

                case 1:
                {
                    refusestat = 2;
                    sci_.PlaySound(Refuse[1], true);
                    refuseTimer = refuseTimer3;
                    break;
                }

                case 2:
                {
                    d1_.StopLookAt();
                    d2_.StopLookAt();
                    refusestat = 3;
                    guard_.AnimTrigger(1, true);
                    sci_.PlaySound(Refuse[2], true);
                    Debug.Log("Another door opening, cause refuse");
                    door1.GetComponent <Object_Door>().DoorSwitch();
                    refuseTimer = refuseTimer4;
                    break;
                }

                case 3:
                {
                    guard_.PlaySFX(GeneralSFX[4]);
                    GameController.instance.playercache.Death(0);
                    ActiveRefuse = false;
                    break;
                }
                }
            }
        }

        if (Timer <= 0.0f && StopTimer == false)
        {
            switch (eventstat)
            {
            case 1:
            {
                d1_.StopLookAt();
                d2_.StopLookAt();
                Debug.Log("Door should open");
                door1.GetComponent <Object_Door>().DoorSwitch();
                sci_.PlaySound(Dialogs[0], true);
                sci_.AnimTrigger(-6);
                Timer        = Timer2;
                eventstat    = 2;
                ActiveRefuse = true;
                refuseTimer  = refuseTimer1;
                break;
            }

            case 2:
            {
                d1_.SetPath(path1);
                GameController.instance.PlayHorror(Horror[0], ata1, npc.none);
                eventstat = 3;
                Timer     = 0.8f;
                break;
            }

            case 3:
            {
                d2_.SetPath(path2);
                eventstat = 4;
                Timer     = Timer3;
                break;
            }

            case 4:
            {
                check2    = true;
                StopTimer = true;
                d1_.SetLookAt(GameController.instance.npcController.mainList[(int)npc.scp173].transform);
                d2_.SetLookAt(GameController.instance.npcController.mainList[(int)npc.scp173].transform);
                break;
            }

            case 5:
            {
                d1_.SetPath(path3);
                StartCoroutine(WaitForWalk());
                eventstat = 6;
                Timer     = 3f;
                break;
            }

            case 6:
            {
                Debug.Log("Door should open on chaos");
                door1.GetComponent <Object_Door>().DoorSwitch();
                check3 = true;
                sci_.PlaySound(Dialogs[2], true);
                sci_.AnimTrigger(-6);
                d2_.SetRota(door1.transform);
                d2_.StopLookAt();
                StartCoroutine(SmallSequence());
                eventstat = 7;
                Timer     = Timer4;
                break;
            }

            case 7:
            {
                objPlayer.GetComponent <Player_Control>().FakeBlink(0.6f);
                lightmana.SetActive(false);
                d1_.PlaySound(classd2);
                eventstat = 8;
                Timer     = 0.7f;
                d1_.AnimTrigger(-1, true);

                GameController.instance.npcController.mainList[(int)npc.scp173].transform.rotation = Quaternion.Euler(0, 90, 0);
                GameController.instance.npcController.mainList[(int)npc.scp173].Spawn(false, ata1.position);
                DecalSystem.instance.Decal(ata1.transform.position, new Vector3(90f, 0, 0), 2f, true, 0.4f, 1, 2);
                d1_.StopLookAt();

                break;
            }

            case 8:
            {
                d2_.StopLookAt();
                d2_.AnimTrigger(-5);
                d1_.PlaySFX(GeneralSFX[3]);
                lightmana.SetActive(true);
                sci2_.AnimTrigger(-4);
                sci_.PlaySFX(GeneralSFX[0]);
                eventstat = 9;
                Timer     = 1f;
                GameController.instance.PlayHorror(Horror[1], null, npc.none);
                break;
            }

            case 9:
            {
                lightmana.SetActive(false);
                objPlayer.GetComponent <Player_Control>().FakeBlink(0.3f);
                eventstat = 10;
                Timer     = 0.5f;
                GameController.instance.npcController.mainList[(int)npc.scp173].Spawn(false, ata2.position);
                DecalSystem.instance.Decal(ata2.transform.position, new Vector3(90f, 0, 0), 4f, true, 0.4f, 1, 0);
                d2_.AnimTrigger(-2, true);
                d2_.StopLookAt();
                d2_.PlaySFX(GeneralSFX[3]);
                break;
            }

            case 10:
            {
                check3 = false;
                GameController.instance.npcController.mainList[(int)npc.scp173].Event_Spawn(true, ata2.transform.position);
                guard_.PlaySound(guardWhat[Random.Range(0, guardWhat.Length)]);

                sci_.PlaySFX(GeneralSFX[1]);
                lightmana.SetActive(true);
                sci2_.AnimTrigger(1, true);
                Timer     = Timer5;
                eventstat = 11;
                break;
            }

            case 11:
            {
                lightmana.SetActive(false);
                objPlayer.GetComponent <Player_Control>().FakeBlink(0.4f);
                eventstat = 12;
                Timer     = 0.7f;
                GameController.instance.npcController.mainList[(int)npc.scp173].transform.rotation = Quaternion.Euler(0, -90, 0);
                GameController.instance.npcController.mainList[(int)npc.scp173].Spawn(false, ata3.position);
                guard_.StopLookAt();
                guard_.PlaySound(guardDies);
                guard_.SetRota(GameController.instance.npcController.mainList[(int)npc.scp173].transform);
                sci_.PlaySFX(GeneralSFX[5]);
                break;
            }

            case 12:
            {
                sci_.PlaySFX(GeneralSFX[2]);
                emelight.SetActive(true);
                guard_.AnimTrigger(1, true);
                Timer        = 1.5f;
                eventstat    = 13;
                ActiveTimer2 = true;
                if (GetComponent <ReflectionProbe>() != null)
                {
                    RerenderProbe1.GetComponent <ReflectionProbe>().RenderProbe();
                    RerenderProbe2.GetComponent <ReflectionProbe>().RenderProbe();
                }
                break;
            }

            case 13:
            {
                emelight.SetActive(false);
                objPlayer.GetComponent <Player_Control>().FakeBlink(0.4f);
                GameController.instance.npcController.mainList[(int)npc.scp173].Spawn(false, ataFinal.position);
                eventstat = 14;
                Timer     = 0.7f;
                guard_.AnimTrigger(-2, true);

                guard_.PlaySFX(GeneralSFX[3]);
                sci_.PlaySFX(GeneralSFX[5]);
                sci_.PlaySFX(GeneralSFX[6]);
                StopTimer2 = true;
                flask.SetActive(false);
                break;
            }

            case 14:
            {
                objPlayer.GetComponent <Player_Control>().FakeBlink(0.6f);
                sci_.SetSeq(Alarm);

                guard_.StopRota();
                objPlayer.GetComponent <Player_Control>().playerWarp((GameController.instance.WorldAnchor.transform.position + ((GameController.instance.WorldAnchor.transform.rotation * Quaternion.Inverse(TeleportAnchor.transform.rotation)) * (objPlayer.transform.position - TeleportAnchor.position))), GameController.instance.WorldAnchor.transform.eulerAngles.y - TeleportAnchor.transform.eulerAngles.y);
                d1_.puppetWarp(GameController.instance.WorldAnchor.transform.position + ((GameController.instance.WorldAnchor.transform.rotation * Quaternion.Inverse(TeleportAnchor.transform.rotation)) * (d1.transform.position - TeleportAnchor.position)), GameController.instance.WorldAnchor.transform.eulerAngles.y - TeleportAnchor.transform.eulerAngles.y);
                d2_.puppetWarp(GameController.instance.WorldAnchor.transform.position + ((GameController.instance.WorldAnchor.transform.rotation * Quaternion.Inverse(TeleportAnchor.transform.rotation)) * (d2.transform.position - TeleportAnchor.position)), GameController.instance.WorldAnchor.transform.eulerAngles.y - TeleportAnchor.transform.eulerAngles.y);
                guard_.puppetWarp(GameController.instance.WorldAnchor.transform.position + ((GameController.instance.WorldAnchor.transform.rotation * Quaternion.Inverse(TeleportAnchor.transform.rotation)) * (guard.transform.position - TeleportAnchor.position)), GameController.instance.WorldAnchor.transform.eulerAngles.y - TeleportAnchor.transform.eulerAngles.y);


                d1_.DeactivateCollision();
                d2_.DeactivateCollision();

                StopTimer = true;



                firstEvent.End();

                if (GameController.instance.isAlive)
                {
                    GameController.instance.DefaultAmbiance();
                    GameController.instance.DefMusic();
                    GameController.instance.doGameplay = true;
                    GameController.instance.Action_QuickSave();
                    GameController.instance.SetMapPos(0, 10);
                    GameController.instance.canSave = true;
                    RenderSettings.fog = true;
                    GameController.instance.CullerFlag = true;
                    Destroy(introZone);
                }
                break;
            }
            }
        }



        if (ActiveTimer2)
        {
            TimerSecondary -= Time.deltaTime;
        }
        if (TimerSecondary <= 0.0f && StopTimer2 == false)
        {
            if (flask.activeSelf == true)
            {
                flask.SetActive(false);
            }
            else
            {
                flask.SetActive(true);
            }

            guard_.PlaySFX(GeneralSFX[4]);
            TimerSecondary = 0.1f;
        }
    }
    public override void EventUpdate()
    {
        base.EventUpdate();

        timer -= Time.deltaTime;
        if (timer <= 0)
        {
            switch (status)
            {
            case 0:
            {
                sci.SetPath(Path1);
                guard.PlaySound(Voice1, true);
                guard.SetRota(sci.gameObject.transform);
                timer  = time1;
                status = 1;
                break;
            }

            case 1:
            {
                GameController.instance.GlobalSFX.PlayOneShot(vent);
                sci.PlaySound(Voice2, true);
                guard.SetRota(lookat);
                sci.SetRota(lookat);
                timer  = time2;
                status = 2;
                break;
            }

            case 2:
            {
                GameController.instance.player.GetComponent <Player_Control>().FakeBlink(time3 + time4 + time5);
                timer  = time3;
                status = 3;
                break;
            }

            case 3:
            {
                sci.PlaySFX(cronch);
                sci.AnimTrigger(-1, true);
                timer  = time4;
                status = 4;
                break;
            }

            case 4:
            {
                guard.PlaySFX(cronch);
                guard.AnimTrigger(-2, true);
                GameController.instance.npcController.mainList[(int)npc.scp173].Event_Spawn(true, Spawn173.transform.position);
                GameController.instance.npcController.mainList[(int)npc.scp173].transform.rotation = Spawn173.transform.rotation;
                timer  = time5;
                status = 5;
                break;
            }

            case 5:
            {
                EventFinished();
                break;
            }
            }
        }
    }