/// <summary>
 /// Dithers responses by adding noise before passing it to a step response.
 /// If the quality of the noise is 1, the noise is uniform noise.
 /// If the quality of the noise is 2, the noise is triangular noise.
 /// The higher the quality, the closer the noise follow a random distribution.
 /// </summary>
 /// <param name="quantizer">A response curve that converts inputs to discrete outputs.</param>
 /// <param name="quality">The quality.</param>
 /// <param name="noiseScale">The noise scale.</param>
 public DitherResponse(IResponseCurve <float> quantizer, int quality, float noiseScale, float[] errorFactors)
     : this(
         quantizer,
         Generator
         .UniformRandomFloat()
         .Group(quality)
         .Select(group => (group.Average() - 0.5f) * noiseScale),
         errorFactors
         )
 {
 }
Пример #2
0
 public Consideration(
     Guid id,
     string name,
     Input input,
     IResponseCurve responseCurve)
 {
     Id            = id;
     Name          = name;
     Input         = input;
     ResponseCurve = responseCurve;
 }
Пример #3
0

        
        /// <summary>
        /// Constructs a new DitherResponse.
        /// </summary>
        /// <param name="quantizer">The response used to quantize values, such as an instance of StepResponse.</param>
        /// <param name="noiseGenerator">A generator that provides noise. For satisfactory results, the
        /// mean should be 0.</param>
        /// <param name="errorFactors">An array of factors used to diffuse the error over several calls. For example,
        /// if the error factors are [0.6, 0.3, 0.1], then 60% of the error is given added to the next sample,
        /// 30% to the sample after that, and 10% to the sample after that.</param>
        public DitherResponse(
            IResponseCurve <float> quantizer,
            IGenerator <float> noiseGenerator,
            float[] errorFactors)
        {
            this.quantizer      = quantizer;
            this.noiseGenerator = noiseGenerator;
            this.errorFactors   = errorFactors;

            errorBuffer = new float[errorFactors.Length];

            for (int i = 0; i < errorBuffer.Length; i++)
            {
                errorBuffer[i] = 0;
            }

            frontIndex = 0;
        }
Пример #5
0
        /// <summary>
        /// Creates a response curve that transforms the output of the given curve
        /// using the given function.
        /// </summary>
        /// <typeparam name="TSource">The type of the source response curve.</typeparam>
        /// <typeparam name="TResult">The type of the result response curve.</typeparam>
        /// <param name="source">The source curve.</param>
        /// <param name="selector">The selector used to transform results from the source curve.</param>
        /// <returns>IResponseCurve&lt;TResult&gt;.</returns>
        /// <example>The following makes a response curve that returns string representation of the
        /// results of a float response curve:
        /// <code>
        /// var curve = new ResponseCurveFloat(new[] {0f, 0.5f, 1f}, new []{0f, 1f, 10f}).Select(x => x.TosString());
        ///
        /// uiComponent.text = (curve[0.75f]);
        /// </code></example>

        public static IResponseCurve <TResult> Select <TSource, TResult>(
            this IResponseCurve <TSource> source,
            Func <TSource, TResult> selector)
        {
            return(new SelectResponse <TSource, TResult>(source, selector));
        }
Пример #6
0
 public DrinkValueCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #7
0
 public FoodValueCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #8
0

        
Пример #9
0
 public Consideration(IResponseCurve curve)
 {
     Curve = curve;
 }
Пример #10
0
 public CanMoveCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #11
0
 public ClothingInInventoryCon(EquipmentSlotDefines.SlotFlags slotFlags, IResponseCurve curve) : base(curve)
 {
     _slot = slotFlags;
 }
Пример #12
0

        
Пример #13
0
 public MeleeWeaponSpeedCon(IResponseCurve curve) : base(curve)
 {
 }
 public RangedWeaponFireRateCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #15
0
 public CanUnarmedCombatCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #16
0
 public DistanceCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #17
0
 public HasTargetLosCon(IResponseCurve curve) : base(curve)
 {
 }
 public RangedWeaponEquippedCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #19
0
 public FreeHandCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #20
0
 public TargetInOurHandsCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #21
0
 public TargetAccessibleCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #22
0
 public HitscanChargerFullCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #23
0
 public ThirstCon(IResponseCurve curve) : base(curve)
 {
 }
 public HitscanWeaponEquippedCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #25
0
 public DummyCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #26
0
 public MeleeWeaponDamageCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #27
0
 public TargetIsDeadCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #28
0
 public SelectResponse(IResponseCurve <TSource> source, Func <TSource, TResult> selector)
 {
     this.source   = source;
     this.selector = selector;
 }
 public BallisticWeaponEquippedCon(IResponseCurve curve) : base(curve)
 {
 }
Пример #30
0
 public HungerCon(IResponseCurve curve) : base(curve)
 {
 }