parent
35c7e9a25e
commit
fbad33213c
@ -1,29 +1,70 @@
|
|||||||
namespace Babushka.scripts.CSharp.Common.Farming;
|
namespace Babushka.scripts.CSharp.Common.Farming;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Holds Information about the current state of the watering can.
|
||||||
|
/// Since there is only one watering can, we can track this in one central static class.
|
||||||
|
/// </summary>
|
||||||
public static class WateringCanState
|
public static class WateringCanState
|
||||||
{
|
{
|
||||||
private static int _fillstate = 0;
|
private static int _fillstate = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How many fields can be watered with one filling of the watering can.
|
||||||
|
/// </summary>
|
||||||
public const int MAX_FILLSTATE = 6;
|
public const int MAX_FILLSTATE = 6;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Tool ID of the watering can. Used to identify it amongst other pickup items (and things that can be held by Vesna).
|
||||||
|
/// </summary>
|
||||||
|
public const int WATERING_CAN_ID = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether or not the watering can is currently active, i.e. held in hand by Vesna.
|
||||||
|
/// Triggers animations and ui.
|
||||||
|
/// </summary>
|
||||||
|
public static bool Active = false;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the fillstate to the max amount.
|
||||||
|
/// </summary>
|
||||||
public static void Fill()
|
public static void Fill()
|
||||||
{
|
{
|
||||||
_fillstate = MAX_FILLSTATE;
|
_fillstate = MAX_FILLSTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when watering a field. Reduces the current fillstate.
|
||||||
|
/// </summary>
|
||||||
public static void Water()
|
public static void Water()
|
||||||
{
|
{
|
||||||
if(_fillstate > 0)
|
if(_fillstate > 0)
|
||||||
_fillstate--;
|
_fillstate--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the watering can. Equivalent to "Empty" state.
|
||||||
|
/// </summary>
|
||||||
public static void Reset()
|
public static void Reset()
|
||||||
{
|
{
|
||||||
_fillstate = 0;
|
_fillstate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the current fill state of the watering can.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public static int GetFillState()
|
public static int GetFillState()
|
||||||
{
|
{
|
||||||
return _fillstate;
|
return _fillstate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the Active state of the watering can, i.e. if it is currently in hand and if the ui should be active.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="active"></param>
|
||||||
|
public static void SetActive(bool active)
|
||||||
|
{
|
||||||
|
Active = active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in new issue