/// <summary>Keeps result inside</summary> public Value Divide(ReadOnlyValue divider, bool showMessageAboutNegativeValue = true) { //if (invalue.get() <= 0) //{ // if (showMessageAboutNegativeValue) // Debug.Log("Value divide failed"); // value = 99999; //} //else Set(rawUIntValue / (float)divider.RawUIntValue); return(this); }
/// <summary>Keeps result inside</summary> public Value Multiply(ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true) { //if (howMuch.get() < 0) //{ // if (showMessageAboutNegativeValue) // Debug.Log("Value multiply failed"); // value = 0; //} //else Set(howMuch.get() * get()); return(this); }
//TODO overflow checks? public Value Add(ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true) { if (rawUIntValue + howMuch.RawUIntValue < 0f) { if (showMessageAboutNegativeValue) { Debug.Log("Value Add-Value failed"); } Set(0); } else { rawUIntValue += howMuch.RawUIntValue; } return(this); }
public Value Subtract(ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true) { if (howMuch.RawUIntValue > rawUIntValue) { if (showMessageAboutNegativeValue) { Debug.Log("Value subtract gave negative result"); } Set(0); } else { rawUIntValue -= howMuch.RawUIntValue; } return(this); }
/// <summary>Keeps result inside</summary> public Value multiply(ReadOnlyValue invalue, bool showMessageAboutNegativeValue = true) { if (invalue.get() < 0) { if (showMessageAboutNegativeValue) { Debug.Log("Value multiply failed"); } value = 0; } else { set(invalue.get() * this.get()); } return(this); }
//TODO overflow checks? virtual public Value Add(ReadOnlyValue invalue, bool showMessageAboutNegativeValue = true) { if (value + invalue.RawValue < 0f) { if (showMessageAboutNegativeValue) { Debug.Log("Value Add-Value failed"); } set(0); } else { value += invalue.RawValue; } return(this); }
/// <summary>Keeps result inside</summary> public Value divide(ReadOnlyValue invalue, bool showMessageAboutNegativeValue = true) { if (invalue.get() <= 0) { if (showMessageAboutNegativeValue) { Debug.Log("Value divide failed"); } value = 99999; } else { set(this.value / (float)invalue.RawValue); } return(this); }
public Value subtract(ReadOnlyValue invalue, bool showMessageAboutNegativeValue = true) { if (invalue.RawValue > value) { if (showMessageAboutNegativeValue) { Debug.Log("Value subtract gave negative result"); } set(0); return(this); } else { value -= invalue.RawValue; return(this); } }
/// <summary> /// Checks inside. Wouldn't pay if can't. Takes back deposits from bank, if needed /// Doesn't pay tax, doesn't register transaction /// </summary> public bool PayWithoutRecord(Agent whom, ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true) { if (this.isBiggerOrEqual(howMuch))// It does has enough cash or deposit { (whom.Cash as Money).Add(howMuch); this.Subtract(howMuch); return(true); } else { if (showMessageAboutNegativeValue) { Debug.Log("Not enough money to pay in Money.payWithoutRecord"); } return(false); } }
public Procent100 Multiply(ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true) { base.Multiply(howMuch, showMessageAboutNegativeValue); clamp100(); return(this); }
public Procent100 Divide(ReadOnlyValue divider, bool showMessageAboutOperationFails = true) { base.Divide(divider, showMessageAboutOperationFails); clamp100(); return(this); }
public Procent100(ReadOnlyValue numerator, ReadOnlyValue denominator, bool showMessageAboutOperationFails = true) : base(numerator, denominator, showMessageAboutOperationFails) { clamp100(); }
public Procent100 Subtract(ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true) { base.Subtract(howMuch, showMessageAboutNegativeValue); clamp100(); return(this); }
/// <summary> /// Returns true if bigger than argument + barrier /// </summary> public bool isBiggerThan(ReadOnlyValue invalue, ReadOnlyValue barrier) { return(rawUIntValue > invalue.rawUIntValue + barrier.rawUIntValue); }
public Storage(Product inProduct, ReadOnlyValue inAmount) : base(inAmount) { product = inProduct; }
public bool isSmallerThan(ReadOnlyValue invalue) { return(this.value < invalue.value); }
public void Set(ReadOnlyValue invalue) { rawUIntValue = invalue.RawUIntValue; }
/// <summary> /// Returns true if bigger than argument + barrier /// </summary> public bool isBiggerThan(ReadOnlyValue invalue, ReadOnlyValue barrier) { return(this.value > invalue.value + barrier.value); }
public bool isSmallerOrEqual(ReadOnlyValue invalue) { return(rawUIntValue <= invalue.rawUIntValue); }
public bool IsEqual(ReadOnlyValue invalue) { return(this.value == invalue.value); }
public bool isBiggerThan(ReadOnlyValue invalue) { return(this.value > invalue.value); }
protected ReadOnlyValue(ReadOnlyValue number) { value = number.value; }
//protected public Value(ReadOnlyValue number) : base(number) { // set(number); // set already have multiplier }
public bool isSmallerOrEqual(ReadOnlyValue invalue) { return(this.value <= invalue.value); }
public bool isSmallerThan(ReadOnlyValue invalue) { return(rawUIntValue < invalue.rawUIntValue); }
public Procent Subtract(ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true) { return(base.Subtract(howMuch, showMessageAboutNegativeValue) as Procent); }
public bool isBiggerOrEqual(ReadOnlyValue invalue) { return(rawUIntValue >= invalue.rawUIntValue); }
public Procent(ReadOnlyValue numerator, ReadOnlyValue denominator, bool showMessageAboutOperationFails = true) : this(numerator.get(), denominator.get(), showMessageAboutOperationFails) { }
public bool isBiggerOrEqual(ReadOnlyValue invalue) { return(this.value >= invalue.value); }
/// <summary> /// returns new value /// </summary> public Storage Multiply(ReadOnlyValue invalue) { //return new Storage(this.getProduct(), get() * invalue.get()); multiply(invalue); return(this); }