Ejemplo n.º 1
0
        public bool IsDayPhaseForMusic(DayPhase phase)
        {
            float dayFraction = this.DayFraction;
            float num1        = DayPhaseExtensions.MusicStartTime(phase);
            float num2        = DayPhaseExtensions.MusicEndTime(phase);

            if ((double)num1 < (double)num2)
            {
                if ((double)dayFraction >= (double)num1)
                {
                    return((double)dayFraction <= (double)num2);
                }
                else
                {
                    return(false);
                }
            }
            else if ((double)dayFraction < (double)num1)
            {
                return((double)dayFraction <= (double)num2);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 2
0
        public float DayPhaseFraction(DayPhase phase)
        {
            float num = this.DayFraction - DayPhaseExtensions.StartTime(phase);

            if ((double)num < 1.0)
            {
                ++num;
            }
            return(num / DayPhaseExtensions.Duration(phase));
        }
Ejemplo n.º 3
0
 public TimeManager()
 {
     this.TimeFactor  = this.DefaultTimeFactor;
     this.CurrentTime = TimeManager.InitialTime;
     this.Tick       += (Action)(() =>
     {
         this.DawnContribution = TimeManager.Ease(this.DayFraction, DayPhaseExtensions.StartTime(DayPhase.Dawn), DayPhaseExtensions.Duration(DayPhase.Dawn));
         this.DuskContribution = TimeManager.Ease(this.DayFraction, DayPhaseExtensions.StartTime(DayPhase.Dusk), DayPhaseExtensions.Duration(DayPhase.Dusk));
         this.NightContribution = TimeManager.Ease(this.DayFraction, DayPhaseExtensions.StartTime(DayPhase.Night), DayPhaseExtensions.Duration(DayPhase.Night));
         this.NightContribution = Math.Max(this.NightContribution, TimeManager.Ease(this.DayFraction, DayPhaseExtensions.StartTime(DayPhase.Night) - 1f, DayPhaseExtensions.Duration(DayPhase.Night)));
     });
 }