WitValue.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. */
  8. using Meta.WitAi.Json;
  9. using UnityEngine;
  10. namespace Meta.WitAi.Data
  11. {
  12. public abstract class WitValue : ScriptableObject
  13. {
  14. [SerializeField] public string path;
  15. private WitResponseReference reference;
  16. public WitResponseReference Reference
  17. {
  18. get
  19. {
  20. if (null == reference)
  21. {
  22. reference = WitResultUtilities.GetWitResponseReference(path);
  23. }
  24. return reference;
  25. }
  26. }
  27. public abstract object GetValue(WitResponseNode response);
  28. public abstract bool Equals(WitResponseNode response, object value);
  29. public string ToString(WitResponseNode response)
  30. {
  31. return Reference.GetStringValue(response);
  32. }
  33. }
  34. }