Ejemplo n.º 1
0
 public void SetSwitch(LightSwitchScript ls)
 {
     lightSwitch = ls;
 }
 private void Update()
 {
     if (!this.Clock.StopTime && this.EventCheck && this.Clock.HourTime > this.EventTime)
     {
         this.EventStudent = this.StudentManager.Students[30];
         if (this.EventStudent != null && this.EventStudent.Routine && !this.EventStudent.Distracted && !this.EventStudent.Talking && !this.EventStudent.Alarmed && !this.EventStudent.Meeting)
         {
             if (!this.EventStudent.WitnessedMurder)
             {
                 this.EventStudent.CharacterAnimation.CrossFade(this.EventStudent.WalkAnim);
                 this.EventStudent.CurrentDestination    = this.EventLocation[1];
                 this.EventStudent.Pathfinding.target    = this.EventLocation[1];
                 this.EventStudent.Pathfinding.canSearch = true;
                 this.EventStudent.Pathfinding.canMove   = true;
                 this.EventStudent.LightSwitch           = this.LightSwitch;
                 this.EventStudent.Obstacle.checkTime    = 99f;
                 this.EventStudent.SpeechLines.Stop();
                 this.EventStudent.ToiletEvent = this;
                 this.EventStudent.InEvent     = true;
                 this.EventStudent.Prompt.Hide();
                 this.Prompt.enabled = true;
                 this.EventCheck     = false;
                 this.EventActive    = true;
                 if (this.EventStudent.Following)
                 {
                     this.EventStudent.Pathfinding.speed = 1f;
                     this.EventStudent.Following         = false;
                     this.EventStudent.Routine           = true;
                     this.Yandere.Follower = null;
                     this.Yandere.Followers--;
                     this.EventStudent.Subtitle.UpdateLabel(SubtitleType.StopFollowApology, 0, 3f);
                     this.EventStudent.Prompt.Label[0].text = "     Talk";
                 }
             }
             else
             {
                 base.enabled = false;
             }
         }
     }
     if (this.EventActive)
     {
         if (this.Prompt.Circle[0].fillAmount == 0f)
         {
             this.Yandere.EmptyHands();
             this.Prompt.Hide();
             this.Prompt.enabled = false;
             this.EventPhase     = 5;
             this.Timer          = 0f;
             AudioClipPlayer.Play(this.EventClip[1], this.EventStudent.transform.position + Vector3.up * 1.5f, 5f, 10f, out this.VoiceClip);
             this.EventSubtitle.text = this.EventSpeech[1];
             this.EventStudent.MyController.enabled = false;
             this.EventStudent.Distracted           = true;
             this.EventStudent.Routine   = false;
             this.EventStudent.Drowned   = true;
             this.Yandere.TargetStudent  = this.EventStudent;
             this.Yandere.Attacking      = true;
             this.Yandere.CanMove        = false;
             this.Yandere.Drown          = true;
             this.Yandere.DrownAnim      = "f02_toiletDrownA_00";
             this.EventStudent.DrownAnim = "f02_toiletDrownB_00";
             this.EventStudent.CharacterAnimation.CrossFade(this.EventStudent.DrownAnim);
         }
         if (this.Clock.HourTime > this.EventTime + 0.5f || this.EventStudent.WitnessedMurder || this.EventStudent.Splashed || this.EventStudent.Dying || this.EventStudent.Alarmed)
         {
             this.EndEvent();
         }
         else if (!this.EventStudent.Pathfinding.canMove)
         {
             if (this.EventPhase == 1)
             {
                 if (this.Timer == 0f)
                 {
                     this.EventStudent.Character.GetComponent <Animation>().CrossFade(this.EventStudent.IdleAnim);
                     this.Prompt.HideButton[0] = false;
                     this.EventStudent.Prompt.Hide();
                     this.EventStudent.Prompt.enabled = false;
                     this.StallDoor.Prompt.enabled    = false;
                     this.StallDoor.Prompt.Hide();
                 }
                 this.Timer += Time.deltaTime;
                 if (this.Timer > 3f)
                 {
                     this.StallDoor.Locked = true;
                     this.StallDoor.CloseDoor();
                     this.Toilet.enabled = false;
                     this.Prompt.Hide();
                     this.Prompt.enabled = false;
                     this.EventStudent.CurrentDestination = this.EventLocation[2];
                     this.EventStudent.Pathfinding.target = this.EventLocation[2];
                     this.EventStudent.TargetDistance     = 2f;
                     this.EventPhase++;
                     this.Timer = 0f;
                 }
             }
             else if (this.EventPhase == 2)
             {
                 if (this.Timer == 0f)
                 {
                     this.EventStudent.Character.GetComponent <Animation>().CrossFade(this.EventAnim[1]);
                     this.BucketPour.enabled = true;
                 }
                 this.Timer += Time.deltaTime;
                 if (this.Timer > 10f)
                 {
                     AudioClipPlayer.Play(this.EventClip[2], this.Toilet.transform.position, 5f, 10f, out this.VoiceClip);
                     this.EventPhase++;
                     this.Timer = 0f;
                 }
             }
             else if (this.EventPhase == 3)
             {
                 this.Timer += Time.deltaTime;
                 if (this.Timer > 4f)
                 {
                     this.EventStudent.CurrentDestination = this.EventLocation[3];
                     this.EventStudent.Pathfinding.target = this.EventLocation[3];
                     this.EventStudent.TargetDistance     = 2f;
                     this.StallDoor.gameObject.SetActive(true);
                     this.StallDoor.Prompt.enabled = true;
                     this.StallDoor.Locked         = false;
                     this.EventPhase++;
                     this.Timer = 0f;
                 }
             }
             else if (this.EventPhase == 4)
             {
                 this.EventStudent.Character.GetComponent <Animation>().CrossFade("f02_washHands_00");
                 this.Timer += Time.deltaTime;
                 if (this.Timer > 5f)
                 {
                     this.EndEvent();
                 }
             }
             else if (this.EventPhase == 5)
             {
                 this.Timer += Time.deltaTime;
                 if (this.Timer > 9f)
                 {
                     this.Splashes.Stop();
                     this.EventOver = true;
                     this.EndEvent();
                 }
                 else if (this.Timer > 3f)
                 {
                     this.EventSubtitle.text = string.Empty;
                     this.Splashes.Play();
                 }
             }
             this.Distance = Vector3.Distance(this.Yandere.transform.position, this.EventStudent.transform.position);
             if (this.Distance < 10f)
             {
                 float num = Mathf.Abs((this.Distance - 10f) * 0.2f);
                 if (num < 0f)
                 {
                     num = 0f;
                 }
                 if (num > 1f)
                 {
                     num = 1f;
                 }
                 this.EventSubtitle.transform.localScale = new Vector3(num, num, num);
             }
             else
             {
                 this.EventSubtitle.transform.localScale = Vector3.zero;
             }
         }
     }
     if (this.ToiletCountdown > 0f)
     {
         this.ToiletCountdown -= Time.deltaTime;
         if (this.ToiletCountdown < 0f)
         {
             this.Toilet.enabled = true;
         }
     }
 }