using System.Collections; using System.Collections.Generic; using UnityEngine; namespace AibisDream { public class CommonUtil { private const float Epsilon = 1e-5f; /// /// 判断为0 /// /// 浮点数 /// 是否为0 public static bool IsZero(float value) { // 如果value小于epsilon,则认为它等于0 return Mathf.Abs(value) < Epsilon; } /// /// 判断浮点数是否相等 /// /// value1 /// value2 /// 是否相等 public static bool IsEqual(float value1, float value2) { return Mathf.Abs(value1 - value2) < Epsilon; } } }