Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.5 KiB

  1. using UnityEngine;
  2. namespace AmplifyShaderEditor
  3. {
  4. [System.Serializable]
  5. public class WireBezierReference
  6. {
  7. private Rect m_boundingBox;
  8. private int m_inNodeId;
  9. private int m_inPortId;
  10. private int m_outNodeId;
  11. private int m_outPortId;
  12. public WireBezierReference()
  13. {
  14. m_boundingBox = new Rect();
  15. m_inNodeId = -1;
  16. m_inPortId = -1;
  17. m_outNodeId = -1;
  18. m_outPortId = -1;
  19. }
  20. public WireBezierReference( ref Rect area, int inNodeId, int inPortId, int outNodeId, int outPortId )
  21. {
  22. UpdateInfo( ref area, inNodeId, inPortId, outNodeId, outPortId );
  23. }
  24. public void UpdateInfo( ref Rect area, int inNodeId, int inPortId, int outNodeId, int outPortId )
  25. {
  26. m_boundingBox = area;
  27. m_inNodeId = inNodeId;
  28. m_inPortId = inPortId;
  29. m_outNodeId = outNodeId;
  30. m_outPortId = outPortId;
  31. }
  32. public bool Contains( Vector2 position )
  33. {
  34. return m_boundingBox.Contains( position );
  35. }
  36. public void DebugDraw()
  37. {
  38. GUI.Label( m_boundingBox, string.Empty, UIUtils.GetCustomStyle( CustomStyle.MainCanvasTitle ));
  39. }
  40. public override string ToString()
  41. {
  42. return string.Format( "In node: {0} port: {1} -> Out node: {2} port: {3}", m_inNodeId, m_inPortId, m_outNodeId, m_outPortId );
  43. }
  44. public Rect BoundingBox { get { return m_boundingBox; } }
  45. public int InNodeId { get { return m_inNodeId; } }
  46. public int InPortId { get { return m_inPortId; } }
  47. public int OutNodeId { get { return m_outNodeId; } }
  48. public int OutPortId { get { return m_outPortId; } }
  49. }
  50. }