namespace Zinnia.Data.Type.Observer
{
using System;
using UnityEngine;
using UnityEngine.Events;
using Zinnia.Extension;
///
/// Allows observing changes of a .
///
public class FloatObservableProperty : ObservableProperty
{
///
/// Defines the event with the state.
///
[Serializable]
public class UnityEvent : UnityEvent { }
[Tooltip("The tolerance to consider the current value and the cached value equal.")]
[SerializeField]
private float equalityTolerance = float.Epsilon;
///
/// The tolerance to consider the current value and the cached value equal.
///
public float EqualityTolerance
{
get
{
return equalityTolerance;
}
set
{
equalityTolerance = value;
}
}
///
protected override bool Equals(float a, float b)
{
return a.ApproxEquals(b, EqualityTolerance);
}
}
}