OutlineSettingsWithLayerMask.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright (C) 2019-2021 Alexander Bogarsukov. All rights reserved.
  2. // See the LICENSE.md file in the project root for more information.
  3. using System;
  4. using UnityEngine;
  5. namespace UnityFx.Outline
  6. {
  7. [Serializable]
  8. internal class OutlineSettingsWithLayerMask : OutlineSettingsInstance
  9. {
  10. #region data
  11. #pragma warning disable 0649
  12. // NOTE: There are custom editors for public components, so no need to show these in default inspector.
  13. [SerializeField, HideInInspector]
  14. private OutlineFilterMode _filterMode;
  15. [SerializeField, HideInInspector]
  16. private LayerMask _layerMask;
  17. [SerializeField, HideInInspector]
  18. private uint _renderingLayerMask = 1;
  19. #pragma warning restore 0649
  20. #endregion
  21. #region interface
  22. public int OutlineLayerMask
  23. {
  24. get
  25. {
  26. if (_filterMode == OutlineFilterMode.UseLayerMask)
  27. {
  28. return _layerMask;
  29. }
  30. if (_filterMode == OutlineFilterMode.UseRenderingLayerMask)
  31. {
  32. return -1;
  33. }
  34. return 0;
  35. }
  36. }
  37. public uint OutlineRenderingLayerMask
  38. {
  39. get
  40. {
  41. if (_filterMode == OutlineFilterMode.UseLayerMask)
  42. {
  43. return uint.MaxValue;
  44. }
  45. if (_filterMode == OutlineFilterMode.UseRenderingLayerMask)
  46. {
  47. return _renderingLayerMask;
  48. }
  49. return 0;
  50. }
  51. }
  52. #endregion
  53. #region implementation
  54. #endregion
  55. }
  56. }