浏览代码

State Inspector improvements

/main
Ciro Continisio 4 年前
当前提交
8316ca44
共有 3 个文件被更改,包括 19 次插入5 次删除
  1. 4
      UOP1_Project/Assets/Scripts/StateMachine/Editor/StateEditor.cs
  2. 10
      UOP1_Project/Assets/Scripts/StateMachine/Editor/TransitionDisplayHelper.cs
  3. 10
      UOP1_Project/Assets/Scripts/StateMachine/Editor/TransitionTableEditor.cs

4
UOP1_Project/Assets/Scripts/StateMachine/Editor/StateEditor.cs


if (prop.objectReferenceValue != null)
{
var label = prop.objectReferenceValue.name;
r.width = 20;
r.width = 35;
r.x += 25;
r.x += 42;
GUI.Label(r, label, EditorStyles.boldLabel);
}
else

10
UOP1_Project/Assets/Scripts/StateMachine/Editor/TransitionDisplayHelper.cs


var prop = reorderableList.serializedProperty.GetArrayElementAtIndex(index);
rect = new Rect(rect.x, rect.y + 2.5f, rect.width, EditorGUIUtility.singleLineHeight);
var condition = prop.FindPropertyRelative("Condition");
// Draw the picker for the Condition SO
if (condition.objectReferenceValue != null)
{
string label = condition.objectReferenceValue.name;

r.width = 20;
r.width = 35;
r.x += 25;
r.width = rect.width;
r.x += 40;
r.width = rect.width - 120;
GUI.Label(r, label, EditorStyles.boldLabel);
}
else

// Draw the boolean value expected by the condition (i.e. "Is True", "Is False")
EditorGUI.LabelField(new Rect(rect.x + rect.width - 80, rect.y, 20, rect.height), "Is");
EditorGUI.PropertyField(new Rect(rect.x + rect.width - 60, rect.y, 60, rect.height), prop.FindPropertyRelative("ExpectedResult"), GUIContent.none);

10
UOP1_Project/Assets/Scripts/StateMachine/Editor/TransitionTableEditor.cs


private void StateEditorGUI()
{
Separator();
// Back button
Separator();
EditorGUILayout.HelpBox("Edit the Actions that a State performs per frame. The order represent the order of execution.", MessageType.Info);
Separator();
// State name
Separator();
_cachedStateEditor.OnInspectorGUI();
}

正在加载...
取消
保存