Exemplo n.º 1
0
 void SetMethod(MethodInfo method)
 {
     if (method != null)
     {
         functionWrapper = ReflectedActionWrapper.Create(method, blackboard);
     }
 }
Exemplo n.º 2
0
        ////////////////////////////////////////
        ///////////GUI AND EDITOR STUFF/////////
        ////////////////////////////////////////
                #if UNITY_EDITOR
        protected override void OnTaskInspectorGUI()
        {
            if (!Application.isPlaying && GUILayout.Button("Select Property"))
            {
                System.Action <MethodInfo> MethodSelected = (method) => {
                    functionWrapper = ReflectedActionWrapper.Create(method, blackboard);
                };

                if (agent != null)
                {
                    EditorUtils.ShowGameObjectMethodSelectionMenu(agent.gameObject, typeof(void), typeof(object), MethodSelected, 1, true, false);
                }
                else
                {
                    var menu = new UnityEditor.GenericMenu();
                    foreach (var t in UserTypePrefs.GetPreferedTypesList(typeof(Component)))
                    {
                        menu = EditorUtils.GetMethodSelectionMenu(t, typeof(void), typeof(object), MethodSelected, 1, true, false, menu);
                    }
                    menu.ShowAsContext();
                    Event.current.Use();
                }
            }

            if (targetMethod != null)
            {
                GUILayout.BeginVertical("box");
                UnityEditor.EditorGUILayout.LabelField("Type", agentType.FriendlyName());
                UnityEditor.EditorGUILayout.LabelField("Property", targetMethod.Name);
                UnityEditor.EditorGUILayout.LabelField("Set Type", functionWrapper.GetVariables()[0].varType.FriendlyName());
                GUILayout.EndVertical();
                EditorUtils.BBParameterField("Set Value", functionWrapper.GetVariables()[0]);
            }
        }