private static GazeFocusSettings GetSettingsFromObject(JSONNode json) { var gfs = new GazeFocusSettings(); gfs.LayerMask = json["LayerMask"].AsInt; gfs.MaximumDistance = json["MaximumDistance"].AsFloat; return(gfs); }
public bool Equals(GazeFocusSettings otherSettings) { return(LayerMask == otherSettings.LayerMask && (float.IsInfinity(MaximumDistance) && float.IsInfinity(otherSettings.MaximumDistance) || Math.Abs(MaximumDistance - otherSettings.MaximumDistance) < float.Epsilon)); }
/// <summary> /// Overwrites the currently stored settings with the supplied /// gazeFocusSettings. This call will only affect the stored settings, /// it will not update the settings loaded by the gaze focus system. /// </summary> /// <remarks>Will only store settings if called in Unity Editor.</remarks> /// <param name="gazeFocusSettings"></param> public static void Set(GazeFocusSettings gazeFocusSettings) { #if UNITY_EDITOR && UNITY_STANDALONE var json = new JSONClass(); json["LayerMask"].AsInt = gazeFocusSettings.LayerMask; json["MaximumDistance"].AsFloat = gazeFocusSettings.MaximumDistance; var settingsAsJson = json.ToString(); File.WriteAllText(FilePath, settingsAsJson); #endif }