namespace Zinnia.Rule
{
using UnityEngine;
using Zinnia.Extension;
///
/// Determines whether a given is equal to the within a .
///
public class Vector2EqualsRule : Vector2Rule
{
[Tooltip("The Vector2 to check equality against.")]
[SerializeField]
private Vector2 target;
///
/// The to check equality against.
///
public Vector2 Target
{
get
{
return target;
}
set
{
target = value;
}
}
[Tooltip("The tolerance between the two Vector2 values that can be considered equal.")]
[SerializeField]
private float tolerance = float.Epsilon;
///
/// The tolerance between the two values that can be considered equal.
///
public float Tolerance
{
get
{
return tolerance;
}
set
{
tolerance = value;
}
}
///
protected override bool Accepts(Vector2 targetVector2)
{
return targetVector2.ApproxEquals(Target, Tolerance);
}
}
}