Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEditor;
- using UnityEngine;
- using System.Collections.Generic;
- using System;
- using System.IO;
- using System.Runtime.Serialization.Formatters.Binary;
- using UnityEngine;
- // Interact.cs
- public class Interact : MonoBehaviour
- {
- public Component cmp;
- public string method;
- public bool negate;
- public UnityEngine.Events.UnityEvent pass;
- public UnityEngine.Events.UnityEvent fail;
- public void invoke()
- {
- if (cmp == null) return;
- var m = cmp.GetType().GetMethod(method);
- if (m == null) return;
- bool b = (bool)m.Invoke(cmp, null);
- if (negate) b = !b;
- if (b) pass.Invoke(); else fail.Invoke();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement