4 namespace HKI.Core.AI.StateMachine.Editor
11 [CustomPropertyDrawer(typeof(AITransition))]
15 const string decisionSPName =
"Decision";
16 const string trueStateSPName =
"TrueState";
17 const string falseStateSPName =
"FalseState";
19 const float decisionLabelWidth = 60.0f;
20 const float trueStateLabelWidth = 75.0f;
21 const float falseStateLabelWidth = 75.0f;
24 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
26 SerializedProperty decisionSP =
property.FindPropertyRelative(decisionSPName);
27 SerializedProperty trueStateSP =
property.FindPropertyRelative(trueStateSPName);
28 SerializedProperty falseStateSP =
property.FindPropertyRelative(falseStateSPName);
30 float fieldWidth = (position.width - decisionLabelWidth - trueStateLabelWidth - falseStateLabelWidth) / 3.0f;
32 position.width = decisionLabelWidth;
33 EditorGUI.LabelField(position,
"Decision:");
35 position.x += decisionLabelWidth;
36 position.width = fieldWidth;
37 EditorGUI.PropertyField(position, decisionSP, GUIContent.none);
39 position.x += fieldWidth;
40 position.width = trueStateLabelWidth;
41 EditorGUI.LabelField(position,
"True State:");
43 position.x += trueStateLabelWidth;
44 position.width = fieldWidth;
45 EditorGUI.PropertyField(position, trueStateSP, GUIContent.none);
47 position.x += fieldWidth;
48 position.width = falseStateLabelWidth;
49 EditorGUI.LabelField(position,
"False State:");
51 position.x += falseStateLabelWidth;
52 position.width = fieldWidth;
53 EditorGUI.PropertyField(position, falseStateSP, GUIContent.none);
This is obsolete code it'll be removed later. For now it's still included for exemplary purposes for ...
override void OnGUI(Rect position, SerializedProperty property, GUIContent label)