コード例 #1
0
ファイル: TimeManager.cs プロジェクト: Jonanory/Reputations
 public void FastForward(int FFDay,float FFTime)
 {
     int test = 0;
     if(FFDay >= currentDayReference){
         if(FFDay > currentDayReference){
             while(currentDayReference < FFDay && test<100){
                 FastForwardCurrentDay(24f);
                 currentDay=days[++currentDayReference];
                 currentDay.LoadDay();
                 time = 0;
                 nextEvent = currentDay.NextEvent(0);
                 ResetScheduleHeap(0);
                 test++;
             }
             FastForwardCurrentDay(FFTime);
             TimeToUnits(FFTime);
             time = FFTime;
         } else if (FFTime > time){
             FastForwardCurrentDay(FFTime);
             TimeToUnits(FFTime);
             time = FFTime;
         }
     }
 }
コード例 #2
0
ファイル: TimeManager.cs プロジェクト: Jonanory/Reputations
 void UpdateTime()
 {
     inGameSeconds += Time.deltaTime * (1440f / realMinutesPerDay);
     if(inGameSeconds>=60){
         inGameMinutes += Mathf.FloorToInt(inGameSeconds/60);
         inGameSeconds %= 60;
         if(inGameMinutes >= 60){
             inGameHours += Mathf.FloorToInt(inGameMinutes/60);
             inGameMinutes %= 60;
             if(inGameHours >= 24){
                 inGameHours = inGameHours % 24;
                 currentDay=days[++currentDayReference];
                 currentDay.LoadDay();
                 nextEvent = currentDay.NextEvent(0);
                 foreach(KeyValuePair<string,Person> person in Population.master.peopleDictionary){
                     if(person.Value.schedule!=null) person.Value.schedule.NextSchedule(0);
                 }
             }
         }
     }
     time = (float)inGameHours + (float)inGameMinutes / 60f;
 }