Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. using UnityEditor;
  2. using UnityEngine;
  3. using System.Collections.Generic;
  4. using System;
  5. using System.IO;
  6. using System.Runtime.Serialization.Formatters.Binary;
  7. using UnityEngine;
  8.  
  9. // Interact.cs
  10. public class Interact : MonoBehaviour
  11. {
  12. public Component cmp;
  13. public string method;
  14. public bool negate;
  15. public UnityEngine.Events.UnityEvent pass;
  16. public UnityEngine.Events.UnityEvent fail;
  17.  
  18. public void invoke()
  19. {
  20. if (cmp == null) return;
  21. var m = cmp.GetType().GetMethod(method);
  22. if (m == null) return;
  23. bool b = (bool)m.Invoke(cmp, null);
  24. if (negate) b = !b;
  25. if (b) pass.Invoke(); else fail.Invoke();
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement