public TimeToken(string value, int position, int hour, int? minute, Meridiem meridiem)
     : base(value, position)
 {
     Hour = hour;
     Minute = minute;
     Meridiem = meridiem;
 }
Example #2
0
        public AnalogueTime(int hour, int minute, Meridiem meridiem)
        {
            if (hour < 0 || hour > 12)
            {
                throw new ArgumentException("Hour should be in [0..12]", nameof(hour));
            }

            if (minute < 0 || minute > 59)
            {
                throw new ArgumentException("Minute should be in [0..59]", nameof(minute));
            }

            this.Hour     = hour;
            this.Minute   = minute;
            this.Meridiem = meridiem;
        }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (!canCycleDay)
        {
            return;
        }

        elapsedMS += Time.deltaTime * dayMinuteToSecond;

        if (elapsedMS > 1.0f)
        {
            elapsedMS = 0.0f;

            dayMinute += 1;

            if (dayMinute > 59)
            {
                dayMinute = 0;

                dayHour += 1;

                if (dayHour > 12)
                {
                    dayHour = 1;

                    switch (dayMeridiem)
                    {
                    case Meridiem.AM:
                    {
                        dayMeridiem = Meridiem.PM;
                        break;
                    }

                    case Meridiem.PM:
                    {
                        dayMeridiem = Meridiem.AM;
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                }
            }

            if (dayMeridiem == Meridiem.AM)
            {
                if (dayHour >= 6 && dayMinute == 0)
                {
                    daysPassed++;
                    return;
                }
            }

            AdjustMeridiem();

            TrackPartOfDay();
        }
    }
Example #4
0
 public void SetMeridiem(Meridiem meridiem)
 {
     dayMeridiem = meridiem;
 }