//Idle, Eat, Sleep, PlayVideoGame, Work public void OnUpdate() { int happinessDelta = 0; int fullnessDelta = 0; int sobernessDelta = 0; if (!IsInterrupted()) { happinessDelta = naturalHappinessDelta.Get(); fullnessDelta = naturalFullnessDelta.Get(); sobernessDelta = naturalSobernessFactoredDelta.GetWithFactor(stats.fullness.GetRatio()); } switch (currentMainActivity) { case MainActivity.Idle: InterruptByChance(idleInterruptChance); break; case MainActivity.Eat: if (!IsInterrupted()) { happinessDelta += eatHappinessDelta.Get(); fullnessDelta += eatFullnessDelta.Get(); sobernessDelta += eatSobernessDelta.Get(); FoodAmount -= Time.fixedDeltaTime; } if (!HasFood()) { Interrupt(); } else { InterruptByChance(eatInterruptChance); } break; case MainActivity.Sleep: if (!IsInterrupted()) { happinessDelta += sleepHappinessDelta.Get(); fullnessDelta += sleepFullnessDelta.Get(); sobernessDelta += sleepSobernessDelta.Get(); SleepAmount -= Time.fixedDeltaTime; } if (!CanSleep()) { Interrupt(); } else { InterruptByChance(sleepInterruptChance); } break; case MainActivity.PlayVideoGame: if (!IsInterrupted()) { happinessDelta += playVideoHappinessDelta.Get(); fullnessDelta += playVideoGameFullnessDelta.Get(); sobernessDelta += playVideoGameSobernessDelta.Get(); } InterruptByChance(playVideoGameInterruptChance); break; case MainActivity.Work: if (!IsInterrupted()) { happinessDelta += workHappinessDelta.Get(); fullnessDelta += workFullnessDelta.Get(); sobernessDelta += workSobernessDelta.Get(); workProgress += Time.fixedDeltaTime; if (workProgress >= workProgressAmountForMilestone) { workProgress = 0; workMilstoneIndex += 1; } } if (!stats.AllInZone()) { InterruptByChance(workInterruptChanceIfNotInZone); } break; } if (SnackAmount > 0 && IsCurrentMainActivityAtTable()) { if (!IsInterrupted()) { happinessDelta += snackHappinessDelta.Get(); fullnessDelta += snackFullnessDelta.Get(); sobernessDelta += snackSobernessDelta.Get(); SnackAmount -= Time.fixedDeltaTime; } } stats.happiness.Add((int)(happinessDelta * Time.fixedDeltaTime)); stats.fullness.Add((int)(fullnessDelta * Time.fixedDeltaTime)); stats.soberness.Add((int)(sobernessDelta * Time.fixedDeltaTime)); TimeRemaining -= Time.fixedDeltaTime; if (InterruptCount > 0) { InterruptCount -= Time.fixedDeltaTime; if (InterruptCount <= 0) { SetMainActivity(activityDecider.Decide()); workIsCalled = false; interruptedByMimi = false; } } }