ShadowMonetColorer.cs 736 B

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