Group.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace GraphProcessor
  5. {
  6. /// <summary>
  7. /// Group the selected node when created
  8. /// </summary>
  9. [System.Serializable]
  10. public class Group
  11. {
  12. public string title;
  13. public Color color = new Color(0, 0, 0, 0.3f);
  14. public Rect position;
  15. public Vector2 size;
  16. /// <summary>
  17. /// Store the GUIDs of the node in the group
  18. /// </summary>
  19. /// <typeparam name="string">GUID of a node</typeparam>
  20. /// <returns></returns>
  21. public List< string > innerNodeGUIDs = new List< string >();
  22. // For serialization loading
  23. public Group() {}
  24. /// <summary>
  25. /// Create a new group with a title and a position
  26. /// </summary>
  27. /// <param name="title"></param>
  28. /// <param name="position"></param>
  29. public Group(string title, Vector2 position)
  30. {
  31. this.title = title;
  32. this.position.position = position;
  33. }
  34. /// <summary>
  35. /// Called when the Group is created
  36. /// </summary>
  37. public virtual void OnCreated()
  38. {
  39. size = new Vector2(400, 200);
  40. position.size = size;
  41. }
  42. }
  43. }