33 lines
1.2 KiB
C#
33 lines
1.2 KiB
C#
using System;
|
|
|
|
namespace Utility
|
|
{
|
|
[Flags]
|
|
public enum EndGameCondition
|
|
{
|
|
Win = 0x01,
|
|
Lose = 0x02,
|
|
|
|
Win_GamePublished = Win | 0x04,
|
|
Lose_NoDevelopersLeft = Lose | 0x08,
|
|
Lose_DeadlineMissed = Lose | 0x10
|
|
}
|
|
|
|
public static class EndGameConditionExtension
|
|
{
|
|
public static bool IsWin(this EndGameCondition endGameCondition) =>
|
|
endGameCondition.HasFlag(EndGameCondition.Win);
|
|
|
|
public static bool IsLose(this EndGameCondition endGameCondition) =>
|
|
endGameCondition.HasFlag(EndGameCondition.Lose);
|
|
|
|
public static string GetEndGameMessage(this EndGameCondition endGameCondition) =>
|
|
endGameCondition switch
|
|
{
|
|
EndGameCondition.Win_GamePublished => "Dein Spiel wurde erfolgreich veröffentlicht!",
|
|
EndGameCondition.Lose_NoDevelopersLeft => "Oh nein, alle deine Entwickler sind weg!",
|
|
EndGameCondition.Lose_DeadlineMissed => "Oh nein, du hast die Deadline verpasst!",
|
|
_ => throw new ArgumentOutOfRangeException(nameof(endGameCondition), endGameCondition, null)
|
|
};
|
|
}
|
|
} |