You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Babushka/scripts/CSharp/Common/Farming/WateringCanState.cs

70 lines
1.9 KiB

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
{
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;
/// <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()
{
_fillstate = MAX_FILLSTATE;
}
/// <summary>
/// Called when watering a field. Reduces the current fillstate.
/// </summary>
public static void Water()
{
if(_fillstate > 0)
_fillstate--;
}
/// <summary>
/// Resets the watering can. Equivalent to "Empty" state.
/// </summary>
public static void Reset()
{
_fillstate = 0;
}
/// <summary>
/// Returns the current fill state of the watering can.
/// </summary>
/// <returns></returns>
public static int GetFillState()
{
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;
}
}