Esempio n. 1
0
        public override void OnBodyGUI()
        {
            serializedObject.Update();

            AISetVariable node = target as AISetVariable;

            GUILayout.BeginHorizontal();
            NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input"), GUILayout.MinWidth(0));
            NodeEditorGUILayout.PortField(GUIContent.none, target.GetOutputPort("output"), GUILayout.MinWidth(0));
            GUILayout.EndHorizontal();

            EditorGUILayout.PropertyField(serializedObject.FindProperty("variableType"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("variableName"), new GUIContent("Name:"));
            switch (node.variableType)
            {
            case AISetVariable.VariableType.Float:
                serializedObject.FindProperty("fVariable").floatValue = EditorGUILayout.FloatField("Value:", serializedObject.FindProperty("fVariable").floatValue);
                break;

            case AISetVariable.VariableType.String:
                serializedObject.FindProperty("sVariable").stringValue = EditorGUILayout.TextField("Value:", serializedObject.FindProperty("sVariable").stringValue);
                break;

            case AISetVariable.VariableType.Int:
                serializedObject.FindProperty("iVariable").intValue = EditorGUILayout.IntField("Value:", serializedObject.FindProperty("iVariable").intValue);
                break;

            case AISetVariable.VariableType.UnityObject:
                serializedObject.FindProperty("uVariable").objectReferenceValue = EditorGUILayout.ObjectField("Value:", serializedObject.FindProperty("uVariable").objectReferenceValue, typeof(UnityEngine.Object), false);
                break;
            }
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnBodyGUI()
        {
            serializedObject.Update();

            AISetVariable node = target as AISetVariable;

            GUILayout.BeginHorizontal();
            NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input"), GUILayout.MinWidth(0));
            GUILayout.EndHorizontal();

            EditorGUILayout.LabelField(new GUIContent("Wait Range"));
            GUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("waitTimeMin"), new GUIContent(""), GUILayout.MaxWidth(20f));
            float min = serializedObject.FindProperty("waitTimeMin").floatValue;
            float max = serializedObject.FindProperty("waitTimeMax").floatValue;

            EditorGUILayout.MinMaxSlider(ref min, ref max, 0f, 10f);
            serializedObject.FindProperty("waitTimeMin").floatValue = min;
            serializedObject.FindProperty("waitTimeMax").floatValue = max;
            EditorGUILayout.PropertyField(serializedObject.FindProperty("waitTimeMax"), new GUIContent(""), GUILayout.MaxWidth(20f));
            GUILayout.EndHorizontal();

            serializedObject.ApplyModifiedProperties();
        }