Files
SimUL/Assets/Scripts/Player/Stat.cs
T
Vladimir Koshevarov b71fa6a9eb Refactor code
2023-02-28 16:19:40 +02:00

42 lines
781 B
C#

public class Stat
{
public string Name { get; set; }
public decimal Value { get; set; }
public decimal Price { get; set; }
public decimal Quantity { get; set; }
public Stat(string name, decimal startValue)
{
Name = name;
Value = startValue;
}
public Stat(string name, decimal price, decimal quantity)
{
Name = name;
Price = price;
Quantity = quantity;
}
public void increase(decimal byAmount)
{
Value += byAmount;
}
public bool deduct(decimal amount)
{
if (Value >= amount)
{
Value -= amount;
return true;
}
return false;
}
public void forceDeduct(decimal amount)
{
Value -= amount;
}
}