EventCallback.cs 525 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using UnityEngine;
  3. namespace I2.Loc
  4. {
  5. [Serializable]
  6. public class EventCallback
  7. {
  8. public void Execute(UnityEngine.Object Sender = null)
  9. {
  10. if (this.HasCallback() && Application.isPlaying)
  11. {
  12. this.Target.gameObject.SendMessage(this.MethodName, Sender, SendMessageOptions.DontRequireReceiver);
  13. }
  14. }
  15. public bool HasCallback()
  16. {
  17. return this.Target != null && !string.IsNullOrEmpty(this.MethodName);
  18. }
  19. public MonoBehaviour Target;
  20. public string MethodName = string.Empty;
  21. }
  22. }