Пример #1
0
 // Start is called before the first frame update
 void Awake()
 {
     state = DayState.GetInstance();
     buttonUse.onClick.AddListener(() => { ActionPerformed(buttonUse); });
     buttonAlarm.onClick.AddListener(() => { ActionPerformed(buttonAlarm); });
     buttonPhone.onClick.AddListener(() => { ActionPerformed(buttonPhone); });
     buttonExit.onClick.AddListener(() => { ActionPerformed(buttonExit); });
 }
Пример #2
0
 public void DoClock(Context context, int hour)
 {
     if (9 <= hour && hour < 17)
     {
         context.ChangeState(NoonState.GetInstance());
     }
     else if (9 <= hour && hour < 17)
     {
         context.ChangeState(DayState.GetInstance());
     }
 }
Пример #3
0
 public void DoClock(Context context, int hour)
 {
     if (hour < 9 || 17 <= hour)
     {
         context.ChangeState(NightState.GetInstance());
     }
     else if (9 <= hour && hour < 12 || 13 <= hour && hour < 17)
     {
         context.ChangeState(DayState.GetInstance());
     }
 }