More betterer Time tracking and basic Win/Lose check
This commit is contained in:
68
3d Prototyp/Assets/Scripts/Utility/Difficulty.cs
Normal file
68
3d Prototyp/Assets/Scripts/Utility/Difficulty.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using System;
|
||||
|
||||
namespace Utility
|
||||
{
|
||||
public enum Difficulty
|
||||
{
|
||||
Easy,
|
||||
Medium,
|
||||
Hard
|
||||
}
|
||||
|
||||
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 class EasyDifficulty : DifficultySettings
|
||||
{
|
||||
public EasyDifficulty()
|
||||
{
|
||||
Difficulty = Difficulty.Easy;
|
||||
DaysUntilReleaseFactor = 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
public class MediumDifficulty : DifficultySettings
|
||||
{
|
||||
public MediumDifficulty()
|
||||
{
|
||||
Difficulty = Difficulty.Medium;
|
||||
DaysUntilReleaseFactor = 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"
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user