Initialized everything and completed Bucket.cs, Fire.cs, Well.cs.
This commit is contained in:
parent
176b3b7cbb
commit
6d01e25314
5 changed files with 55 additions and 31 deletions
|
|
@ -5,7 +5,7 @@
|
|||
/// </summary>
|
||||
public sealed class Fire
|
||||
{
|
||||
// TODO
|
||||
private readonly double _growRate;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new fire with the passed properties.
|
||||
|
|
@ -14,19 +14,19 @@ public sealed class Fire
|
|||
/// <param name="growRate">Rate by which the fire grows with each (chain operation) step</param>
|
||||
public Fire(double initialFireSize, double growRate)
|
||||
{
|
||||
// TODO
|
||||
_growRate = growRate;
|
||||
FireSize = initialFireSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current size of the fire; cannot be smaller than 0.
|
||||
/// </summary>
|
||||
// TODO
|
||||
// public double FireSize ...
|
||||
public double FireSize { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets if the fire has been extinguished (= size is 0).
|
||||
/// </summary>
|
||||
public bool Extinguished => false; // TODO
|
||||
public bool Extinguished => FireSize <= 0D;
|
||||
|
||||
/// <summary>
|
||||
/// The fire is hit by a load of water from a bucket.
|
||||
|
|
@ -35,7 +35,7 @@ public sealed class Fire
|
|||
/// <param name="amount">Liters of water</param>
|
||||
public void GetHitByWater(double amount)
|
||||
{
|
||||
// TODO
|
||||
FireSize = FireSize - amount < 0D ? 0D : FireSize - amount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -44,7 +44,7 @@ public sealed class Fire
|
|||
/// </summary>
|
||||
public void BurnHigher()
|
||||
{
|
||||
// TODO
|
||||
FireSize += _growRate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -52,5 +52,5 @@ public sealed class Fire
|
|||
/// The size is rounded to whole numbers.
|
||||
/// </summary>
|
||||
/// <returns>String representation of the fire</returns>
|
||||
public override string ToString() => string.Empty; // TODO
|
||||
public override string ToString() => $"🔥 {Math.Round(FireSize)}";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue