private void gestionMoonintensity() { // on vérifie si au moins 1 des 2 lunes à un impact sur l'environnement if (fireMoon.moonIntensity > fireMoonMinIntensity || coldMoon.moonIntensity > coldMoonMinIntensity) { float _fireMoonIntensity = calculateMoonIntensity(fireMoon.moonIntensity, fireMoonMinIntensity); float coldMoonIntensity = calculateMoonIntensity(coldMoon.moonIntensity, coldMoonMinIntensity); // on notifie les éléments subissant l'impact des lunes MoonEvent.onMoonPresence(_fireMoonIntensity, coldMoonIntensity); } // si on est en double lune if (isDoubleMoon()) { // check si c'est plus la double lune (si l'une des 2 lunes a une intensité au dessous de leur valeur de zenith if (fireMoon.moonIntensity < fireMoonZenith || coldMoon.moonIntensity < coldMoonMinIntensity) { MoonEvent.onDoubleMoonEnd(); doubleMoon = false; } } // si on est pas en double lune else { // check si c'est la double lune (si les 2 lunes ont une intensité au dessus de leur valeur de zenith if (fireMoon.moonIntensity >= fireMoonZenith && coldMoon.moonIntensity >= coldMoonMinIntensity) { MoonEvent.onDoubleMoonBegin(); doubleMoon = true; } } }
/// <summary> /// Returns moon rise data in format: 1st event (rise or set) and 2nd event (rise or set) /// Удобно для выводва данных (примеры есть в тексте) /// </summary> /// <param name="CurDate">Дата DateTime</param> /// <param name="lat">Долгота, доли градуса</param> /// <param name="lon">Долгота, доли градуса</param> /// <param name="timezoneoffset">Смещение, 3 для Москвы</param> /// <param name="outMoonEvent1">out Event1</param> /// <param name="outMoonEvent2">out Event2</param> public static void getMoonEventTimesForDate(DateTime CurDate, double lat, double lon, double timezoneoffset, out MoonEvent outMoonEvent1, out MoonEvent outMoonEvent2) { DateTime CurSession = CurDate.AddHours(-12); //int Date = ; DateTime MoonRiseDT0, MoonSetDT0; DateTime MoonRiseDT1, MoonSetDT1; DateTime MoonRiseDT_1, MoonSetDT_1; MoonClass.calculateMoonTimes(CurSession.Year, CurSession.Month, CurSession.Day, lat, lon, timezoneoffset, out MoonRiseDT0, out MoonSetDT0); MoonClass.calculateMoonTimes(CurSession.AddDays(1).Year, CurSession.AddDays(1).Month, CurSession.AddDays(1).Day, lat, lon, timezoneoffset, out MoonRiseDT1, out MoonSetDT1); MoonClass.calculateMoonTimes(CurSession.AddDays(-1).Year, CurSession.AddDays(-1).Month, CurSession.AddDays(-1).Day, lat, lon, timezoneoffset, out MoonRiseDT_1, out MoonSetDT_1); MoonEvent MoonEvent1 = new MoonEvent(); MoonEvent MoonEvent2 = new MoonEvent(); if (MoonSetDT0.Hour < MoonRiseDT0.Hour && (MoonSetDT0.Day == CurSession.Day) && (MoonRiseDT0.Day == CurSession.Day)) { //Console.Write(" ..." + MoonSetDT0.ToString("MM-dd H:m")); //Console.Write(" " + MoonRiseDT0.ToString("MM-dd H:m") + "..."); MoonEvent1.EventTime = MoonSetDT0; MoonEvent1.EventType = MoonEventType.MoonSet; MoonEvent2.EventTime = MoonRiseDT0; MoonEvent2.EventType = MoonEventType.MoonRise; } else if ((MoonSetDT0.Day != CurSession.Day) || (MoonRiseDT0.Day != CurSession.Day)) { if (MoonSetDT0.Hour == 0) { //Console.Write("" + MoonRiseDT0.ToString("MM-dd H:m")); //Console.Write("..." + MoonSetDT1.ToString("MM-dd H:m") + ""); MoonEvent1.EventTime = MoonRiseDT0; MoonEvent1.EventType = MoonEventType.MoonRise; MoonEvent2.EventTime = MoonSetDT1; MoonEvent2.EventType = MoonEventType.MoonSet; } else if (MoonRiseDT0.Hour == 0) { //Console.Write("" + MoonRiseDT_1.ToString("MM-dd H:m")); //Console.Write("..." + MoonSetDT0.ToString("MM-dd H:m") + ""); MoonEvent1.EventTime = MoonRiseDT_1; MoonEvent1.EventType = MoonEventType.MoonRise; MoonEvent2.EventTime = MoonSetDT0; MoonEvent2.EventType = MoonEventType.MoonSet; } } else { //Console.Write("" + MoonRiseDT0.ToString("MM-dd H:m")); //Console.Write("..." + MoonSetDT0.ToString("MM-dd H:m") + ""); MoonEvent1.EventTime = MoonRiseDT0; MoonEvent1.EventType = MoonEventType.MoonRise; MoonEvent2.EventTime = MoonSetDT0; MoonEvent2.EventType = MoonEventType.MoonSet; } outMoonEvent1 = MoonEvent1; outMoonEvent2 = MoonEvent2; }
/* * EVENTS FORM */ public static void getMoonEventTimesForDate(out MoonEvent outMoonEvent1, out MoonEvent outMoonEvent2) { getMoonEventTimesForDate(DateTime.Now, Latitude, Longitude, SiteTimeZone, out outMoonEvent1, out outMoonEvent2); }