-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdateTimerMode.cs
More file actions
34 lines (28 loc) · 1.12 KB
/
UpdateTimerMode.cs
File metadata and controls
34 lines (28 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Kitchen;
using KitchenMods;
using Unity.Entities;
using UnityEngine;
namespace KitchenInGameTimer
{
[UpdateInGroup(typeof(CreationGroup))]
public class UpdateTimerMode : RestaurantSystem, IModSystem
{
protected override void OnUpdate()
{
if (!Main.PrefManager.Get<bool>(Main.TIMER_ENABLED_ID))
{
Clear<STimer>();
return;
}
STimer timer = GetOrCreate<STimer>();
string runDuring = Main.PrefManager.Get<string>(Main.TIMER_MODE_ID);
timer.RunDay = runDuring == "ALWAYS_RUN" || runDuring == "DURING_DAY";
timer.RunNight = runDuring == "ALWAYS_RUN" || runDuring == "DURING_NIGHT";
string autoReset = Main.PrefManager.Get<string>(Main.TIMER_RESET_MODE_ID);
timer.ResetStartOfDay = autoReset == "START_AND_END" || autoReset == "START_OF_DAY";
timer.ResetStartOfNight = autoReset == "START_AND_END" || autoReset == "END_OF_DAY";
timer.RunWhenPaused = !Main.PrefManager.Get<bool>(Main.TIMER_PAUSE_MODE_ID);
Set(timer);
}
}
}