示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (inProgressTask != null)
     {
         float multiplier      = inProgressTask.Name == "Sleep" ? 1 : TaskSpeedMultiplier;
         int   timerBreakpoint = Mathf.CeilToInt(taskTimer * multiplier);
         taskTimer = Mathf.Max(taskTimer - (Time.deltaTime / multiplier), 0);
         if (taskTimer == 0)
         {
             CompleteTask();
         }
         if (timerBreakpoint > Mathf.CeilToInt(taskTimer * multiplier))
         {
             DayController.DoTask();
         }
     }
     if (inProgressTask == null && DayController.Energy == 0 && !(todoTasks.Count > 0 && todoTasks[0].Name == "Sleep"))
     {
         todoTasks.Clear();
         todoTasks.Add(new Task("Sleep", "Bed", 3));
         hintTimer = hintDelay;
         UpdateTaskUI();
     }
     if (hintTimer != 0)
     {
         hintTimer = Mathf.Max(0, hintTimer - Time.deltaTime);
         if (hintTimer == 0)
         {
             Debug.Log("Showing hint");
             if (todoTasks.Count > 0)
             {
                 Room.ShowHint(todoTasks[0].Object);
             }
         }
     }
 }