示例#1
0
        internal void AddFoodPoisoningCall(string causeId)
        {
            float incubationPeriodHours = UnityEngine.Random.Range(Tuning.foodPoisoningDelayHoursMin, Tuning.foodPoisoningDelayHoursMax);
            float triggerTimeHours      = GameManager.GetTimeOfDayComponent().GetHoursPlayedNotPaused() + incubationPeriodHours;

            DeferredFoodPoisoning foodPoisoning = new DeferredFoodPoisoning()
            {
                start = triggerTimeHours, cause = causeId
            };

            deferredFoodPoisonings.Add(foodPoisoning);
        }
示例#2
0
        private void UpdateFoodPoisoning()
        {
            float currentTimeHours = GameManager.GetTimeOfDayComponent().GetHoursPlayedNotPaused();

            for (int i = deferredFoodPoisonings.Count - 1; i >= 0; --i)
            {
                DeferredFoodPoisoning foodPoisoning = deferredFoodPoisonings[i];

                if (currentTimeHours > foodPoisoning.start)
                {
                    deferredFoodPoisonings.RemoveAt(i);
                    GameStatePatches.IsApplyingDeferredFoodPoisoning = true;
                    GameManager.GetFoodPoisoningComponent().FoodPoisoningStart(foodPoisoning.cause, true, false);
                    GameStatePatches.IsApplyingDeferredFoodPoisoning = false;
                }
            }
        }