OutlineMonetColorer.cs 748 B

123456789101112131415161718192021222324
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System;
  4. namespace Smoothie.MonetColors.Runtime
  5. {
  6. [RequireComponent(typeof(Outline))]
  7. public class OutlineMonetColorer : MonetColorer
  8. {
  9. public override void UpdateColor()
  10. {
  11. base.UpdateColor();
  12. Outline outline = null;
  13. foreach (var component in GetComponents<Outline>()) if (component.GetType() == typeof(Outline)) outline = component;
  14. if (outline != null)
  15. {
  16. _colorValue.a = outline.effectColor.a;
  17. outline.effectColor = _colorValue;
  18. }
  19. else throw new NullReferenceException("You don't have an Outline component. or something went wrong...");
  20. }
  21. }
  22. }