IInteractable.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. namespace Rokid.UXR.Interaction
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. public struct InteractableStateChangeArgs
  6. {
  7. public InteractableState PreviousState { get; }
  8. public InteractableState NewState { get; }
  9. public InteractableStateChangeArgs(
  10. InteractableState previousState,
  11. InteractableState newState)
  12. {
  13. PreviousState = previousState;
  14. NewState = newState;
  15. }
  16. }
  17. /// <summary>
  18. /// An IInteractableView defines the view for an object that can be
  19. /// interacted with.
  20. /// </summary>
  21. public interface IInteractableView
  22. {
  23. object Data { get; }
  24. InteractableState State { get; }
  25. event Action<InteractableStateChangeArgs> WhenStateChanged;
  26. int MaxInteractors { get; }
  27. int MaxSelectingInteractors { get; }
  28. IEnumerable<IInteractorView> InteractorViews { get; }
  29. IEnumerable<IInteractorView> SelectingInteractorViews { get; }
  30. event Action<IInteractorView> WhenInteractorViewAdded;
  31. event Action<IInteractorView> WhenInteractorViewRemoved;
  32. event Action<IInteractorView> WhenSelectingInteractorViewAdded;
  33. event Action<IInteractorView> WhenSelectingInteractorViewRemoved;
  34. }
  35. /// <summary>
  36. /// An object that can be interacted with, an IInteractable can, in addition to
  37. /// an IInteractableView, be enabled or disabled.
  38. /// </summary>
  39. public interface IInteractable : IInteractableView
  40. {
  41. void Enable();
  42. void Disable();
  43. new int MaxInteractors { get; set; }
  44. new int MaxSelectingInteractors { get; set; }
  45. void RemoveInteractorByIdentifier(int id);
  46. }
  47. }