Files
SimUL/Assets/Scripts/Stat.cs
T
2022-08-17 11:14:32 +03:00

42 lines
772 B
C#

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