ButtonEnable.cs 507 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using UnityEngine;
  3. namespace com.workman.cm3d2.button
  4. {
  5. public class ButtonEnable
  6. {
  7. public ButtonEnable(UIButton uiButton, BoxCollider collider = null)
  8. {
  9. this.uiButton = uiButton;
  10. this.collider = collider;
  11. }
  12. public void SetEnable(bool enabled)
  13. {
  14. if (this.collider != null)
  15. {
  16. this.collider.enabled = enabled;
  17. }
  18. if (this.uiButton != null)
  19. {
  20. this.uiButton.enabled = enabled;
  21. }
  22. }
  23. public UIButton uiButton;
  24. public BoxCollider collider;
  25. }
  26. }