public FixedSafeFloatStack(float initial, FixedFloatStack.StackMethod valueType, float floor, float ceiling, Action <SafeFloat, int, SafeFloat, int> onChanged = null) : base(12, onChanged) { this._value = 0f; switch (valueType) { case FixedFloatStack.StackMethod.Top: base._checkAnyValueChange = false; this._updateValue = new Action(this.UpdateTop); break; case FixedFloatStack.StackMethod.Sum: base._checkAnyValueChange = true; this._updateValue = new Action(this.UpdateSummed); break; case FixedFloatStack.StackMethod.Multiplied: base._checkAnyValueChange = true; this._updateValue = new Action(this.UpdateMultiplied); break; case FixedFloatStack.StackMethod.OneMinusMultiplied: base._checkAnyValueChange = true; initial = 1f - initial; this._updateValue = new Action(this.UpdateOneMinusMultiplied); break; } this._floor = floor; this._ceiling = ceiling; base.onChanged = (Action <SafeFloat, int, SafeFloat, int>)Delegate.Combine(base.onChanged, new Action <SafeFloat, int, SafeFloat, int>(this.SelfOnChanged)); base.Push(initial, true); }
private static void DefineEntityProperty(string propertyName, float defaultValue, FixedFloatStack.StackMethod valueType, float floor = -3.402823E+38f, float ceiling = 3.402823E+38f) { ConfigAbilityPropertyEntry entry = new ConfigAbilityPropertyEntry { Type = ConfigAbilityPropertyEntry.PropertyType.Entity, Default = defaultValue, Stacking = valueType, Floor = floor, Ceiling = ceiling }; PROPERTIES.Add(propertyName, entry); }
public static FixedSafeFloatStack CreateDefault(float initValue, FixedFloatStack.StackMethod stackMethod, float floor, float ceiling, Action <SafeFloat, int, SafeFloat, int> onChanged = null) { return(new FixedSafeFloatStack(initValue, stackMethod, floor, ceiling, onChanged)); }