Пример #1
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);
            }
        }
    }
    public override void EventUpdate()
    {
        if (Time.frameCount % 15 == 0 && eventState != 20 && !outDoorsClosed && isOut.GetState())
        {
            eventState = 1;
            Timer      = 2;

            Object_Door door;
            outDoorsClosed = true;
            audSource.clip = scene1;
            SubtitleEngine.instance.playVoice(scene1.name, true);
            audSource.Play();
            Interact = Physics.OverlapSphere(doorCloser1.position, 1f, doorLayer);
            if (Interact.Length > 0)
            {
                door = Interact[0].gameObject.GetComponent <Object_Door>();
                if (door.GetState())
                {
                    door.DoorSwitch();
                }
                door.isDisabled = true;
            }
            Interact = Physics.OverlapSphere(doorCloser2.position, 1f, doorLayer);
            if (Interact.Length > 0)
            {
                door = Interact[0].gameObject.GetComponent <Object_Door>();
                if (door.GetState())
                {
                    door.DoorSwitch();
                }
                door.isDisabled = true;
            }
            Interact = Physics.OverlapSphere(doorCloser3.position, 1f, doorLayer);
            if (Interact.Length > 0)
            {
                door = Interact[0].gameObject.GetComponent <Object_Door>();
                if (door.GetState())
                {
                    door.DoorSwitch();
                }
                door.isDisabled = true;
            }
            Interact = Physics.OverlapSphere(doorCloser4.position, 1f, doorLayer);
            if (Interact.Length > 0)
            {
                door            = Interact[0].gameObject.GetComponent <Object_Door>();
                door.isDisabled = false;
                if (door.GetState())
                {
                    door.DoorSwitch();
                }
                door.isDisabled = true;
            }
            Interact = Physics.OverlapSphere(doorCloser5.position, 1f, doorLayer);
            if (Interact.Length > 0)
            {
                door            = Interact[0].gameObject.GetComponent <Object_Door>();
                door.isDisabled = false;
                if (door.GetState())
                {
                    door.DoorSwitch();
                }
                door.isDisabled = true;
            }
        }

        if (Time.frameCount % 15 == 0 && eventState == 14 && inDoorsClosed)
        {
            /*eventState = 1;
             * Timer = 2;*/
            inDoorsClosed = false;
            Object_Door door;
            Interact = Physics.OverlapSphere(doorCloser4.position, 1f, doorLayer);
            if (Interact.Length > 0)
            {
                door            = Interact[0].gameObject.GetComponent <Object_Door>();
                door.isDisabled = false;
                if (!door.GetState())
                {
                    door.DoorSwitch();
                }
                door.isDisabled = true;
            }
            Interact = Physics.OverlapSphere(doorCloser5.position, 1f, doorLayer);
            if (Interact.Length > 0)
            {
                door            = Interact[0].gameObject.GetComponent <Object_Door>();
                door.isDisabled = false;
                if (!door.GetState())
                {
                    door.DoorSwitch();
                }
                door.isDisabled = true;
            }
        }

        if (Time.frameCount % 15 == 0 && eventState == 14 && !inDoorsClosed && isIn.GetState())
        {
            eventState    = 15;
            inDoorsClosed = true;

            /*
             * Timer = 2;*/

            Object_Door door;
            Interact = Physics.OverlapSphere(doorCloser4.position, 1f, doorLayer);
            if (Interact.Length > 0)
            {
                door            = Interact[0].gameObject.GetComponent <Object_Door>();
                door.isDisabled = false;
                if (door.GetState())
                {
                    door.DoorSwitch();
                }
                door.isDisabled = true;
            }
            Interact = Physics.OverlapSphere(doorCloser5.position, 1f, doorLayer);
            if (Interact.Length > 0)
            {
                door            = Interact[0].gameObject.GetComponent <Object_Door>();
                door.isDisabled = false;
                if (door.GetState())
                {
                    door.DoorSwitch();
                }
                door.isDisabled = true;

                audSource.PlayOneShot(blackOut);
                GameController.instance.canSave = true;

                GameController.instance.playercache.FakeBlink(0.25f);
                probe.RenderProbe();

                EventFinished();
            }
        }



        Timer -= Time.deltaTime;

        if (Timer < 0)
        {
            switch (eventState)
            {
            case 1:
            {
                Debug.Log("Step one");
                guard.SetPath(new Transform[1] {
                        step1
                    }, false);
                eventState = 2;
                Timer      = 3.5f;
                break;
            }

            case 2:
            {
                guard.AnimTrigger(3, false);
                eventState = 3;
                Timer      = 1.5f;
                break;
            }

            case 3:
            {
                Debug.Log("Step two");
                guard.StopRota();
                guard.SetPath(stepSeq, false);
                eventState = 4;
                Timer      = 0.5f;
                break;
            }

            case 4:
            {
                scp.RotateTo(guard.transform.position);
                eventState = 5;
                Timer      = 1.5f;
                break;
            }

            case 5:
            {
                guard.SetLookAt(scp.transform);
                scp.evChangeState(3);
                eventState = 6;
                Timer      = 1.5f;
                break;
            }

            case 6:
            {
                guard.StopLookAt();
                guard.SetRota(scp.transform);
                guard.AnimTrigger(1, true);
                eventState = 7;
                Timer      = 3;
                break;
            }

            case 7:
            {
                guard.SetPath(new Transform[1] {
                        step3
                    }, false);
                eventState = 8;
                Timer      = 3;
                break;
            }

            case 8:
            {
                guard.SetPath(new Transform[1] {
                        step4
                    }, false);
                eventState = 9;
                Timer      = 3;
                break;
            }

            case 9:
            {
                guard.SetPath(stepSeq2, false);
                eventState = 10;
                Timer      = 1.5f;
                break;
            }

            case 10:
            {
                guard.StopRota();
                guard.AnimTrigger(-3);
                scp.evWalkTo(stepSeq2[1].position);
                eventState = 11;
                Timer      = 0.75f;
                audSource.Stop();
                audSource.clip = scene2;
                audSource.Play();
                break;
            }

            case 11:
            {
                DecalSystem.instance.Decal(decal1.transform.position, decal1.transform.rotation.eulerAngles, 2, false, 0.2f, 1, 2);
                DecalSystem.instance.Decal(decal1.transform.position, decal1.transform.rotation.eulerAngles - new Vector3(0, 180, 0), 2, false, 0.2f, 1, 2);

                DecalSystem.instance.Decal(decal2.transform.position, decal2.transform.rotation.eulerAngles, 2, false, 0.2f, 1, 2);
                DecalSystem.instance.Decal(decal2.transform.position, decal2.transform.rotation.eulerAngles - new Vector3(0, 180, 0), 3, false, 0.2f, 1, 2);

                DecalSystem.instance.Decal(decal3.transform.position, decal3.transform.rotation.eulerAngles, 2, false, 0.2f, 1, 2);
                DecalSystem.instance.Decal(decal3.transform.position, decal3.transform.rotation.eulerAngles - new Vector3(0, 180, 0), 3, false, 0.2f, 1, 2);

                DecalSystem.instance.Decal(decal4.transform.position, decal4.transform.rotation.eulerAngles, 2, false, 0.2f, 1, 2);
                DecalSystem.instance.Decal(decal4.transform.position, decal4.transform.rotation.eulerAngles - new Vector3(0, 180, 0), 2, false, 0.2f, 1, 2);

                eventState = 12;
                Timer      = 0.25f;
                break;
            }

            case 12:
            {
                eventState = 13;
                //scp.evChangeState(0);
                Timer = 10f;
                Destroy(guard.gameObject);
                break;
            }

            case 13:
            {
                eventState = 14;
                scp.StopEvent();
                Debug.Log("096 Stopped");
                break;
            }
            }
        }
    }