78 lines
2.2 KiB
C#
78 lines
2.2 KiB
C#
using System;
|
|
|
|
namespace Utility
|
|
{
|
|
public enum Difficulty
|
|
{
|
|
Easy,
|
|
Medium,
|
|
Hard
|
|
}
|
|
|
|
[Serializable]
|
|
public abstract class DifficultySettings
|
|
{
|
|
public Difficulty Difficulty { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// Faktor, wie viel mehr Zeit man halt als die Entwickler bei 100% effizienz benötigen.
|
|
/// </summary>
|
|
public double DaysUntilReleaseFactor { get; protected set; }
|
|
|
|
public double CaffeineDrainScaling { get; protected set; }
|
|
public double HungerDrainScaling { get; protected set; }
|
|
public double UrinationDrainScaling { get; protected set; }
|
|
public double HappinessDrainScaling { get; protected set; }
|
|
}
|
|
|
|
public class EasyDifficulty : DifficultySettings
|
|
{
|
|
public EasyDifficulty()
|
|
{
|
|
Difficulty = Difficulty.Easy;
|
|
DaysUntilReleaseFactor = 2.0;
|
|
}
|
|
}
|
|
|
|
public class MediumDifficulty : DifficultySettings
|
|
{
|
|
public MediumDifficulty()
|
|
{
|
|
Difficulty = Difficulty.Medium;
|
|
DaysUntilReleaseFactor = 1.5;
|
|
CaffeineDrainScaling = 1.5;
|
|
HungerDrainScaling = 1.5;
|
|
UrinationDrainScaling = 1.5;
|
|
HappinessDrainScaling = 1.5;
|
|
}
|
|
}
|
|
|
|
public class HardDifficulty : DifficultySettings
|
|
{
|
|
public HardDifficulty()
|
|
{
|
|
Difficulty = Difficulty.Hard;
|
|
DaysUntilReleaseFactor = 1.0;
|
|
}
|
|
}
|
|
|
|
public static class DifficultyExtensions
|
|
{
|
|
public static DifficultySettings GetSettings(this Difficulty difficulty) => difficulty switch
|
|
{
|
|
Difficulty.Easy => new EasyDifficulty(),
|
|
Difficulty.Medium => new MediumDifficulty(),
|
|
Difficulty.Hard => new HardDifficulty(),
|
|
_ => throw new ArgumentOutOfRangeException(nameof(difficulty), difficulty, null)
|
|
};
|
|
|
|
public static string GetName(this Difficulty difficulty) =>
|
|
difficulty switch
|
|
{
|
|
Difficulty.Easy => "Entspannt",
|
|
Difficulty.Medium => "Normal",
|
|
Difficulty.Hard => "Stressig",
|
|
_ => "Unbekannt"
|
|
};
|
|
}
|
|
} |