Range.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. namespace BansheeEngine
  5. {
  6. /** @addtogroup Serialization
  7. * @{
  8. */
  9. /// <summary>
  10. /// Makes an integer or a floating point field be displayed as a slider with a specified range in the inspector.
  11. /// </summary>
  12. [AttributeUsage(AttributeTargets.Field)]
  13. public sealed class Range : Attribute
  14. {
  15. /// <summary>
  16. /// Creates a new range attribute.
  17. /// </summary>
  18. /// <param name="min">Minimum boundary of the range to clamp the field value to.</param>
  19. /// <param name="max">Maximum boundary of the range to clamp the field value to.</param>
  20. /// <param name="slider">Whether the field should be rendered as a slider.</param>
  21. public Range(float min, float max, bool slider = true)
  22. {
  23. this.min = min;
  24. this.max = max;
  25. this.slider = slider;
  26. }
  27. #pragma warning disable 0414
  28. private float min;
  29. private float max;
  30. private bool slider;
  31. #pragma warning restore 0414
  32. }
  33. /** @} */
  34. }