44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using UnityEngine;
|
|
|
|
namespace Code.D.Cleaning.CleanTools
|
|
{
|
|
public class Tryapka : CleanTool
|
|
{
|
|
public Tryapka(float durabilityUsageStep, float cleanRadius, Texture2D brushTexture) : base(durabilityUsageStep, cleanRadius, brushTexture)
|
|
{
|
|
}
|
|
|
|
public override CleanToolType ToolType => CleanToolType.Tryapka;
|
|
|
|
public override TryapkaUsageInfo Use()
|
|
{
|
|
if (!IsDirty.CurrentValue)
|
|
{
|
|
CurrentDirtiness.Value += DurabilityUsageStep;
|
|
|
|
if (CurrentDirtiness.Value >= 1) IsDirty.Value = true;
|
|
}
|
|
|
|
return new(CleanRadius, CurrentDirtiness.Value, IsDirty.CurrentValue, BrushTexture);
|
|
}
|
|
|
|
public override void Clean()
|
|
{
|
|
CurrentDirtiness.Value = 0;
|
|
IsDirty.Value = false;
|
|
}
|
|
}
|
|
|
|
public record TryapkaUsageInfo : ToolUsageInfo
|
|
{
|
|
public float Radius;
|
|
|
|
public TryapkaUsageInfo(float radius, float dirtiness, bool isDirty, Texture brush)
|
|
{
|
|
Radius = radius;
|
|
Dirtiness = dirtiness;
|
|
IsDirty = isDirty;
|
|
BrushTexture = brush;
|
|
}
|
|
}
|
|
} |