Enabler.cs 488 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using UnityEngine;
  3. [ExecuteInEditMode]
  4. public class Enabler : MonoBehaviour
  5. {
  6. private void Start()
  7. {
  8. }
  9. public void Enable()
  10. {
  11. if (this.goEnable != null)
  12. {
  13. this.goEnable.SetActive(true);
  14. }
  15. }
  16. public void Disable()
  17. {
  18. if (this.goEnable != null)
  19. {
  20. this.goEnable.SetActive(false);
  21. }
  22. }
  23. private void Update()
  24. {
  25. if (this.goEnable != null)
  26. {
  27. this.goEnable.SetActive(this.flag != 0);
  28. }
  29. }
  30. public int flag;
  31. public GameObject goEnable;
  32. }