Merge branch 'main' of ssh://gitfrieds.nackenbox.xyz:3011/MeigoFried/GameVsJam
This commit is contained in:
commit
e89ddca89b
|
@ -72,11 +72,12 @@ public class TimeManager : MonoBehaviourSingleton<TimeManager>
|
||||||
|
|
||||||
void UpdateTime()
|
void UpdateTime()
|
||||||
{
|
{
|
||||||
|
double oldTotalTime = _totalTime;
|
||||||
|
|
||||||
_totalTime += Time.deltaTime / _secondsPerDay;
|
_totalTime += Time.deltaTime / _secondsPerDay;
|
||||||
|
|
||||||
if (_totalTime >= 1.0)
|
if (Math.Floor(oldTotalTime) < Math.Floor(_totalTime))
|
||||||
{
|
{
|
||||||
_totalTime -= 1.0;
|
|
||||||
_daysUntilRelease--;
|
_daysUntilRelease--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Utility
|
||||||
|
{
|
||||||
|
public static class DayOfWeekExtension
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt den Wochentag zurück, der auf den gegebenen Wochentag folgt.
|
||||||
|
/// </summary>
|
||||||
|
public static DayOfWeek GetNext(this DayOfWeek current) => GetFutureDay(current, 1);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt den Wochentag zurück, der in der gegebenen Anzahl an Tagen auf den gegebenen Wochentag folgt.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="current">Der aktuelle Wochentag.</param>
|
||||||
|
/// <param name="days">Die Anzahl an Tagen, die vergehen sollen.</param>
|
||||||
|
public static DayOfWeek GetFutureDay(this DayOfWeek current, int days) =>
|
||||||
|
(DayOfWeek)(((int)current + days) % 7);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt den deutschen Namen des Wochentags zurück.
|
||||||
|
/// </summary>
|
||||||
|
public static string GetName(this DayOfWeek weekday) => weekday switch
|
||||||
|
{
|
||||||
|
DayOfWeek.Monday => "Montag",
|
||||||
|
DayOfWeek.Tuesday => "Dienstag",
|
||||||
|
DayOfWeek.Wednesday => "Mittwoch",
|
||||||
|
DayOfWeek.Thursday => "Donnerstag",
|
||||||
|
DayOfWeek.Friday => "Freitag",
|
||||||
|
DayOfWeek.Saturday => "Samstag",
|
||||||
|
DayOfWeek.Sunday => "Sonntag",
|
||||||
|
_ => "Unbekannt"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,77 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Utility
|
|
||||||
{
|
|
||||||
public enum Weekday
|
|
||||||
{
|
|
||||||
Monday = 0,
|
|
||||||
Tuesday = 1,
|
|
||||||
Wednesday = 2,
|
|
||||||
Thursday = 3,
|
|
||||||
Friday = 4,
|
|
||||||
Saturday = 5,
|
|
||||||
Sunday = 6
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class WeekdayExtension
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gibt den Wochentag zurück, der auf den gegebenen Wochentag folgt.
|
|
||||||
/// </summary>
|
|
||||||
public static Weekday GetNext(this Weekday current) => GetFutureDay(current, 1);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gibt den Wochentag zurück, der in der gegebenen Anzahl an Tagen auf den gegebenen Wochentag folgt.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="current">Der aktuelle Wochentag.</param>
|
|
||||||
/// <param name="days">Die Anzahl an Tagen, die vergehen sollen.</param>
|
|
||||||
public static Weekday GetFutureDay(this Weekday current, int days) =>
|
|
||||||
(Weekday)(((int)current + days) % 7);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gibt den deutschen Namen des Wochentags zurück.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetName(this Weekday weekday) => weekday switch
|
|
||||||
{
|
|
||||||
Weekday.Monday => "Montag",
|
|
||||||
Weekday.Tuesday => "Dienstag",
|
|
||||||
Weekday.Wednesday => "Mittwoch",
|
|
||||||
Weekday.Thursday => "Donnerstag",
|
|
||||||
Weekday.Friday => "Freitag",
|
|
||||||
Weekday.Saturday => "Samstag",
|
|
||||||
Weekday.Sunday => "Sonntag",
|
|
||||||
_ => "Unbekannt"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DayOfWeekExtension
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gibt den Wochentag zurück, der auf den gegebenen Wochentag folgt.
|
|
||||||
/// </summary>
|
|
||||||
public static DayOfWeek GetNext(this DayOfWeek current) => GetFutureDay(current, 1);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gibt den Wochentag zurück, der in der gegebenen Anzahl an Tagen auf den gegebenen Wochentag folgt.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="current">Der aktuelle Wochentag.</param>
|
|
||||||
/// <param name="days">Die Anzahl an Tagen, die vergehen sollen.</param>
|
|
||||||
public static DayOfWeek GetFutureDay(this DayOfWeek current, int days) =>
|
|
||||||
(DayOfWeek)(((int)current + days) % 7);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gibt den deutschen Namen des Wochentags zurück.
|
|
||||||
/// </summary>
|
|
||||||
public static string GetName(this DayOfWeek weekday) => weekday switch
|
|
||||||
{
|
|
||||||
DayOfWeek.Monday => "Montag",
|
|
||||||
DayOfWeek.Tuesday => "Dienstag",
|
|
||||||
DayOfWeek.Wednesday => "Mittwoch",
|
|
||||||
DayOfWeek.Thursday => "Donnerstag",
|
|
||||||
DayOfWeek.Friday => "Freitag",
|
|
||||||
DayOfWeek.Saturday => "Samstag",
|
|
||||||
DayOfWeek.Sunday => "Sonntag",
|
|
||||||
_ => "Unbekannt"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,6 +4,9 @@ using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Utility;
|
using Utility;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Macht genau das was man erwartet: Schaltet je nach Uhrzeit alle Kinder an oder aus.
|
||||||
|
/// </summary>
|
||||||
public class Zeitschaltuhr : MonoBehaviour, ISerializationCallbackReceiver
|
public class Zeitschaltuhr : MonoBehaviour, ISerializationCallbackReceiver
|
||||||
{
|
{
|
||||||
private TimeSpan _turnOnTimeSpan;
|
private TimeSpan _turnOnTimeSpan;
|
||||||
|
|
Loading…
Reference in New Issue