private static GazeFocusSettings GetSettingsFromObject(SimpleJSON.JSONNode json) { var gfs = new GazeFocusSettings(); gfs.LayerMask = json["LayerMask"].AsInt; gfs.MaximumDistance = json["MaximumDistance"].AsFloat; return(gfs); }
/// <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; string settingsAsJson = json.ToString(); File.WriteAllText(FilePath, settingsAsJson); #endif }
private static void ReloadSettings() { var gazeFocusSettings = GazeFocusSettings.Get(); LayerMask = gazeFocusSettings.LayerMask; MaximumDistance = gazeFocusSettings.MaximumDistance; if (Scorer != null) { Scorer.Reconfigure(MaximumDistance, LayerMask.value); } if (_multiScorer != null) { _multiScorer.Reconfigure(MaximumDistance, LayerMask.value); } }
public bool Equals(GazeFocusSettings otherSettings) { return(this.LayerMask == otherSettings.LayerMask && (float.IsInfinity(this.MaximumDistance) && float.IsInfinity(otherSettings.MaximumDistance) || Math.Abs(this.MaximumDistance - otherSettings.MaximumDistance) < float.Epsilon)); }