// Update is called once per frame void Update() { if (!Paused) { if (speechbubble.activeSelf) { speechbubbletime += Time.deltaTime; if (speechbubbletime > speechbubblelifespan) { speechbubble.SetActive(false); } } else { if (UnityEngine.Random.Range(0f, 1f) < speechbubblechance && OnBreak && !CanInvestigate) { speechbubbletime = 0; speechbubble.SetActive(true); speechbubble.GetComponentInChildren <RandomGlyph>().RandomChar(); if (playsound) { playsound.PlayRandom(); } } } if (!OnBreak && !CanInvestigate) { PassedTime += Time.deltaTime; if (PassedTime > ChosenTime) { ChosenTime = UnityEngine.Random.Range(BreakTimeMin, BreakTimeMax); OnBreak = true; PassedTime = 0; nav.GoToObject(control.BreakObjects[UnityEngine.Random.Range(0, control.BreakObjects.Count)], 6); } } else { PassedTime += Time.deltaTime; if (PassedTime > ChosenTime) { ChosenTime = UnityEngine.Random.Range(WorkTimeMin, WorkTimeMax); OnBreak = false; PassedTime = 0; nav.GoToObject(Office.transform.Find("StandingLocation").gameObject, 3); } } } }