예제 #1
0
 public AnalogClock(double centerX, double centerY, MinuteHand minute, SecondHand second, HourHand hour,
                    Ticks ticks, Face face)
 {
     CenterX = centerX;
     CenterY = centerY;
     Minute  = minute;
     Second  = second;
     Hour    = hour;
     ticks.Set5minTicks(CenterX, CenterX, CenterY);
     face.SetFace();
 }
예제 #2
0
    private void UpdateClock()
    {
        float hour, min, sec;

        hour = dayNightCycle.getTime();
        hour = hour / 3600;

        min = dayNightCycle.getTime();
        min = min / 60;

        sec = dayNightCycle.getTime();

        if (hour > hourTime + 1)
        {
            float temp = hour;
            hour -= hourTime;
            HourHand.Rotate(0, 0, 30 * hour);
            hourTime = temp;
        }

        if (min > minuteTime + 1)
        {
            float temp = min;
            min -= minuteTime;
            MinuteHand.Rotate(0, 0, 6 * min);
            minuteTime = temp;
        }

        if (sec > secondsTime + 1)
        {
            float temp = sec;
            sec -= secondsTime;
            SecondHand.Rotate(0, 0, 6 * sec);
            secondsTime = temp;
        }

        if (dayNightCycle.getDay() > day)
        {
            hourTime    = dayNightCycle.getTime() / 3600;
            minuteTime  = dayNightCycle.getTime() / 60;
            secondsTime = dayNightCycle.getTime();
            HourHand.Rotate(0, 0, 30);
            day++;
        }
    }