コード例 #1
0
ファイル: Value.cs プロジェクト: Austinsmom/Prosperity-Wars
 /// <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);
 }
コード例 #2
0
ファイル: Value.cs プロジェクト: Austinsmom/Prosperity-Wars
 /// <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);
 }
コード例 #3
0
ファイル: Value.cs プロジェクト: Austinsmom/Prosperity-Wars
 //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);
 }
コード例 #4
0
ファイル: Value.cs プロジェクト: Austinsmom/Prosperity-Wars
 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);
 }
コード例 #5
0
 /// <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);
 }
コード例 #6
0
 //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);
 }
コード例 #7
0
 /// <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);
 }
コード例 #8
0
 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);
     }
 }
コード例 #9
0
 /// <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);
     }
 }
コード例 #10
0
 public Procent100 Multiply(ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true)
 {
     base.Multiply(howMuch, showMessageAboutNegativeValue);
     clamp100();
     return(this);
 }
コード例 #11
0
 public Procent100 Divide(ReadOnlyValue divider, bool showMessageAboutOperationFails = true)
 {
     base.Divide(divider, showMessageAboutOperationFails);
     clamp100();
     return(this);
 }
コード例 #12
0
 public Procent100(ReadOnlyValue numerator, ReadOnlyValue denominator, bool showMessageAboutOperationFails = true) : base(numerator, denominator, showMessageAboutOperationFails)
 {
     clamp100();
 }
コード例 #13
0
 public Procent100 Subtract(ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true)
 {
     base.Subtract(howMuch, showMessageAboutNegativeValue);
     clamp100();
     return(this);
 }
コード例 #14
0
 /// <summary>
 /// Returns true if bigger than argument + barrier
 /// </summary>
 public bool isBiggerThan(ReadOnlyValue invalue, ReadOnlyValue barrier)
 {
     return(rawUIntValue > invalue.rawUIntValue + barrier.rawUIntValue);
 }
コード例 #15
0
 public Storage(Product inProduct, ReadOnlyValue inAmount) : base(inAmount)
 {
     product = inProduct;
 }
コード例 #16
0
 public bool isSmallerThan(ReadOnlyValue invalue)
 {
     return(this.value < invalue.value);
 }
コード例 #17
0
ファイル: Value.cs プロジェクト: Austinsmom/Prosperity-Wars
 public void Set(ReadOnlyValue invalue)
 {
     rawUIntValue = invalue.RawUIntValue;
 }
コード例 #18
0
 /// <summary>
 /// Returns true if bigger than argument + barrier
 /// </summary>
 public bool isBiggerThan(ReadOnlyValue invalue, ReadOnlyValue barrier)
 {
     return(this.value > invalue.value + barrier.value);
 }
コード例 #19
0
 public bool isSmallerOrEqual(ReadOnlyValue invalue)
 {
     return(rawUIntValue <= invalue.rawUIntValue);
 }
コード例 #20
0
 public bool IsEqual(ReadOnlyValue invalue)
 {
     return(this.value == invalue.value);
 }
コード例 #21
0
 public bool isBiggerThan(ReadOnlyValue invalue)
 {
     return(this.value > invalue.value);
 }
コード例 #22
0
 protected ReadOnlyValue(ReadOnlyValue number)
 {
     value = number.value;
 }
コード例 #23
0
ファイル: Value.cs プロジェクト: Austinsmom/Prosperity-Wars
 //protected
 public Value(ReadOnlyValue number) : base(number)
 {
     //   set(number); // set already have multiplier
 }
コード例 #24
0
 public bool isSmallerOrEqual(ReadOnlyValue invalue)
 {
     return(this.value <= invalue.value);
 }
コード例 #25
0
 public bool isSmallerThan(ReadOnlyValue invalue)
 {
     return(rawUIntValue < invalue.rawUIntValue);
 }
コード例 #26
0
 public Procent Subtract(ReadOnlyValue howMuch, bool showMessageAboutNegativeValue = true)
 {
     return(base.Subtract(howMuch, showMessageAboutNegativeValue) as Procent);
 }
コード例 #27
0
 public bool isBiggerOrEqual(ReadOnlyValue invalue)
 {
     return(rawUIntValue >= invalue.rawUIntValue);
 }
コード例 #28
0
 public Procent(ReadOnlyValue numerator, ReadOnlyValue denominator, bool showMessageAboutOperationFails = true)
     : this(numerator.get(), denominator.get(), showMessageAboutOperationFails)
 {
 }
コード例 #29
0
 public bool isBiggerOrEqual(ReadOnlyValue invalue)
 {
     return(this.value >= invalue.value);
 }
コード例 #30
0
 /// <summary>
 /// returns new value
 /// </summary>
 public Storage Multiply(ReadOnlyValue invalue)
 {
     //return new Storage(this.getProduct(), get() * invalue.get());
     multiply(invalue);
     return(this);
 }