Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using XGEFCore;
- public class DecimalStat : Stat<Decimal>
- {
- public virtual Decimal MaxValue { get; }
- public virtual Decimal MinValue { get; }
- public override Decimal Value { get; protected set; }
- public override Decimal Modify(Decimal amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual Decimal Add(Decimal amount)
- {
- return Modify(amount);
- }
- public virtual Decimal Subtract(Decimal amount)
- {
- return Add(-amount);
- }
- public virtual Decimal Set(Decimal amount)
- {
- return Add(amount - Value);
- }
- }
- public class DoubleStat : Stat<Double>
- {
- public virtual Double MaxValue { get; }
- public virtual Double MinValue { get; }
- public override Double Value { get; protected set; }
- public override Double Modify(Double amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual Double Add(Double amount)
- {
- return Modify(amount);
- }
- public virtual Double Subtract(Double amount)
- {
- return Add(-amount);
- }
- public virtual Double Set(Double amount)
- {
- return Add(amount - Value);
- }
- }
- public class FloatStat : Stat<Single>
- {
- public virtual Single MaxValue { get; }
- public virtual Single MinValue { get; }
- public override Single Value { get; protected set; }
- public override Single Modify(Single amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual Single Add(Single amount)
- {
- return Modify(amount);
- }
- public virtual Single Subtract(Single amount)
- {
- return Add(-amount);
- }
- public virtual Single Set(Single amount)
- {
- return Add(amount - Value);
- }
- }
- public class ByteStat : Stat<Byte>
- {
- public virtual Byte MaxValue { get; }
- public virtual Byte MinValue { get; }
- public override Byte Value { get; protected set; }
- public override Byte Modify(Byte amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual Byte Add(Byte amount)
- {
- return Modify(amount);
- }
- public virtual Byte Subtract(Byte amount)
- {
- return Add(-amount);
- }
- public virtual Byte Set(Byte amount)
- {
- return Add(amount - Value);
- }
- }
- public class SByteStat : Stat<SByte>
- {
- public virtual SByte MaxValue { get; }
- public virtual SByte MinValue { get; }
- public override SByte Value { get; protected set; }
- public override SByte Modify(SByte amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual SByte Add(SByte amount)
- {
- return Modify(amount);
- }
- public virtual SByte Subtract(SByte amount)
- {
- return Add(-amount);
- }
- public virtual SByte Set(SByte amount)
- {
- return Add(amount - Value);
- }
- }
- public class ShortStat : Stat<Int16>
- {
- public virtual Int16 MaxValue { get; }
- public virtual Int16 MinValue { get; }
- public override Int16 Value { get; protected set; }
- public override Int16 Modify(Int16 amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual Int16 Add(Int16 amount)
- {
- return Modify(amount);
- }
- public virtual Int16 Subtract(Int16 amount)
- {
- return Add(-amount);
- }
- public virtual Int16 Set(Int16 amount)
- {
- return Add(amount - Value);
- }
- }
- public class UShortStat : Stat<UInt16>
- {
- public virtual UInt16 MaxValue { get; }
- public virtual UInt16 MinValue { get; }
- public override UInt16 Value { get; protected set; }
- public override UInt16 Modify(UInt16 amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual UInt16 Add(UInt16 amount)
- {
- return Modify(amount);
- }
- public virtual UInt16 Subtract(UInt16 amount)
- {
- return Add(-amount);
- }
- public virtual UInt16 Set(UInt16 amount)
- {
- return Add(amount - Value);
- }
- }
- public class IntStat : Stat<Int32>
- {
- public virtual Int32 MaxValue { get; }
- public virtual Int32 MinValue { get; }
- public override Int32 Value { get; protected set; }
- public override Int32 Modify(Int32 amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual Int32 Add(Int32 amount)
- {
- return Modify(amount);
- }
- public virtual Int32 Subtract(Int32 amount)
- {
- return Add(-amount);
- }
- public virtual Int32 Set(Int32 amount)
- {
- return Add(amount - Value);
- }
- }
- public class UIntStat : Stat<UInt32>
- {
- public virtual UInt32 MaxValue { get; }
- public virtual UInt32 MinValue { get; }
- public override UInt32 Value { get; protected set; }
- public override UInt32 Modify(UInt32 amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual UInt32 Add(UInt32 amount)
- {
- return Modify(amount);
- }
- public virtual UInt32 Subtract(UInt32 amount)
- {
- return Add(-amount);
- }
- public virtual UInt32 Set(UInt32 amount)
- {
- return Add(amount - Value);
- }
- }
- public class LongStat : Stat<Int64>
- {
- public virtual Int64 MaxValue { get; }
- public virtual Int64 MinValue { get; }
- public override Int64 Value { get; protected set; }
- public override Int64 Modify(Int64 amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual Int64 Add(Int64 amount)
- {
- return Modify(amount);
- }
- public virtual Int64 Subtract(Int64 amount)
- {
- return Add(-amount);
- }
- public virtual Int64 Set(Int64 amount)
- {
- return Add(amount - Value);
- }
- }
- public class ULongStat : Stat<UInt64>
- {
- public virtual UInt64 MaxValue { get; }
- public virtual UInt64 MinValue { get; }
- public override UInt64 Value { get; protected set; }
- public override UInt64 Modify(UInt64 amount)
- {
- Value = Value + amount;
- ClampValue();
- return Value;
- }
- protected virtual void ClampValue()
- {
- Value = (Value < MinValue) ? MinValue : ((Value > MaxValue) ? MaxValue : Value);
- }
- public virtual UInt64 Add(UInt64 amount)
- {
- return Modify(amount);
- }
- public virtual UInt64 Subtract(UInt64 amount)
- {
- return Add(-amount);
- }
- public virtual UInt64 Set(UInt64 amount)
- {
- return Add(amount - Value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement