public float Value (float value, Unit unit=null) { if (unit == null) { unit = relativeUnit; } if (isBase) { if (unit != this) { return 0.1f; Debug.Log ("Relative value not found"); } else { return value / relativeValue; } } if (unit == this) { if (value < 0.1f) { return 0.1f; } else { return value; } } return relativeUnit.Value (value * relativeValue, unit); }
public Unit (float RelativeValue, Unit RelativeUnit, bool IsBase =false) { isBase = IsBase; relativeUnit = RelativeUnit; relativeValue = RelativeValue; }