////////////////////////////////////////
		///////////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), true))
						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]);
			}
		}
 public static ReflectedWrapper Create(MethodInfo method, IBlackboard bb)
 {
     if (method.ReturnType == typeof(void))
     {
         return(ReflectedActionWrapper.Create(method, bb));
     }
     return(ReflectedFunctionWrapper.Create(method, bb));
 }
示例#3
0
 void SetMethod(MethodInfo method)
 {
     if (method != null){
         functionWrapper = ReflectedActionWrapper.Create(method, blackboard);
     }
 }