Files
SimUL/Assets/Scripts/Stat.cs
T
2022-11-17 16:12:51 +02:00

42 lines
806 B
C#

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