No Description
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.

BrushToolsAttribute.cs 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. namespace UnityEditor.Tilemaps
  4. {
  5. /// <summary>
  6. /// An attribute for GridBrushBase which specifies the TilemapEditorTool types which can work with the GridBrushBase.
  7. /// </summary>
  8. [AttributeUsage(AttributeTargets.Class)]
  9. public class BrushToolsAttribute : Attribute
  10. {
  11. private List<Type> m_ToolTypes;
  12. internal List<Type> toolList
  13. {
  14. get { return m_ToolTypes; }
  15. }
  16. /// <summary>
  17. /// Constructor for BrushToolsAttribute. Specify the TilemapEditorTool types which can work with the GridBrushBase.
  18. /// </summary>
  19. /// <param name="tools">An array of TilemapEditorTool types which can work with the GridBrushBase.</param>
  20. public BrushToolsAttribute(params Type[] tools)
  21. {
  22. m_ToolTypes = new List<Type>();
  23. foreach (var toolType in tools)
  24. {
  25. if (toolType.IsSubclassOf(typeof(TilemapEditorTool)) && !m_ToolTypes.Contains(toolType))
  26. {
  27. m_ToolTypes.Add(toolType);
  28. }
  29. }
  30. }
  31. }
  32. }