Greatest Time simulation ever
Außerdem: - Coole Singletons, möglicherweise die geilsten Singletons, die jemals in Unity implementiert wurden - Utility Klassen nach Utility Verschoben - Schlaganfallsymptome in Developer entfernt
This commit is contained in:
29
3d Prototyp/Assets/Scripts/Utility/Weekday.cs
Normal file
29
3d Prototyp/Assets/Scripts/Utility/Weekday.cs
Normal file
@ -0,0 +1,29 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user