public override BBParameter OnGUI(GUIContent content, BBParameter instance)
        {
            var required = fieldInfo.RTIsDefined <RequiredFieldAttribute>(true);
            var bbOnly   = fieldInfo.RTIsDefined <BlackboardOnlyAttribute>(true);

            instance = BBParameterEditor.ParameterField(content, instance, bbOnly, required, info);
            return(instance);
        }
Beispiel #2
0
        public override BBParameter OnGUI(GUIContent content, BBParameter instance)
        {
            var required = fieldInfo.IsDefined(typeof(RequiredFieldAttribute), true);
            var bbOnly   = fieldInfo.IsDefined(typeof(BlackboardOnlyAttribute), true);
            var isNull   = instance == null || instance.isNull;

            GUI.backgroundColor = required && isNull? Colors.lightRed : Color.white;
            instance            = BBParameterEditor.ParameterField(content, instance, bbOnly, attributes);
            GUI.backgroundColor = Color.white;
            return(instance);
        }
Beispiel #3
0
        //...
        void DoParameters()
        {
            if (missingParametersMap.Count == 0)
            {
                GUILayout.Label("No missing BB Parameters found.");
                return;
            }

            foreach (var pair in missingParameterChangesMap)
            {
                BBParameterEditor.ParameterField(pair.Key, pair.Value, GraphEditor.currentGraph);
            }
        }
Beispiel #4
0
        //Shows the agent field in case an agent type is specified through the use of the generic versions of Action or Condition Task
        void ShowAgentField()
        {
            if (task.agentType == null)
            {
                return;
            }

            TaskAgentParameter agentParam = agentParameterProp.value;

            if (Application.isPlaying && task.agentIsOverride && agentParam.value == null)
            {
                GUILayout.Label("<b>Missing Agent Reference</b>".FormatError());
                return;
            }

            GUI.color = Color.white.WithAlpha(task.agentIsOverride ? 0.65f : 0.5f);
            GUILayout.BeginVertical(GUI.skin.box);
            GUILayout.BeginHorizontal();

            if (task.agentIsOverride)
            {
                BBParameterEditor.ParameterField(null, agentParam, task.ownerSystem.contextObject);
            }
            else
            {
                var compInfo = task.agent == null?task.agentType.FriendlyName().FormatError() : task.agentType.FriendlyName();

                var icon    = TypePrefs.GetTypeIcon(task.agentType);
                var label   = string.Format("Use Self ({0})", compInfo);
                var content = EditorUtils.GetTempContent(label, icon);
                GUILayout.Label(content, GUILayout.Height(18), GUILayout.Width(0), GUILayout.ExpandWidth(true));
            }

            GUI.color = Color.white;

            if (!Application.isPlaying)
            {
                var newOverride = EditorGUILayout.Toggle(task.agentIsOverride, GUILayout.Width(18));
                if (newOverride != task.agentIsOverride)
                {
                    UndoUtility.RecordObject(task.ownerSystem.contextObject, "Override Agent");
                    task.agentIsOverride = newOverride;
                }
            }

            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }