コード例 #1
0
        public override void OnInspectorGUI()
        {
            string name        = service.Name;
            string description = string.IsNullOrEmpty(service.comment) ? name : service.comment;

            BehaviorTreesEditorUtility.BeginInspectorGUI(ref name, ref description);
            if (name != service.Name)
            {
                service.Name = name;
                //AssetCreator.SaveAIAsset();
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Target Code", false))
            {
                BehaviorTreesEditorUtility.DrawTargetScript(OnSelected, serializedObject);
                if (service.targetScript != null && BehaviorTreesEditorUtility.DrawTargetMethod(service.targetScript.GetType(), typeof(void), ref service.targetMethod))
                {
                    UpdateName();
                    UpdateComment();
                    BehaviorTreesEditor.RepaintAll();
                    AssetCreator.SaveAIAsset();
                    EditorGUILayout.Space();
                }
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Service", false))
            {
                DrawTick();
            }
            BehaviorTreesEditorUtility.EndInspectorGUI(service);
        }
コード例 #2
0
ファイル: TaskInspector.cs プロジェクト: yabos/SaveTheQueen
        public override void OnInspectorGUI()
        {
            string name        = task.Name;
            string description = string.IsNullOrEmpty(node.description) ? name : node.description;

            BehaviorTreesEditorUtility.BeginInspectorGUI(ref name, ref description);
            if (name != task.Name)
            {
                task.Name        = name;
                task.description = description;
                //AssetCreator.SaveAIAsset();
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Target Code", false))
            {
                BehaviorTreesEditorUtility.DrawTargetScript(OnSelected, serializedObject);
                if (task.targetScript != null && BehaviorTreesEditorUtility.DrawTargetMethod(task.targetScript.GetType(), typeof(eBTStatus), typeof(IEnumerator), ref task.targetMethod))
                {
                    CheckMethod();
                    UpdateName();
                    UpdateComment();
                    BehaviorTreesEditor.RepaintAll();
                    AssetCreator.SaveAIAsset();
                }
            }
            BehaviorTreesEditorUtility.EndInspectorGUI(node);
        }
コード例 #3
0
        protected virtual void UpdateComment()
        {
            string comment = "";

            if (decorator.inversed)
            {
                comment += "( inversed )\n";
            }
            if (decorator.targetScript != null)
            {
                comment += decorator.targetScript.name;
                if (!string.IsNullOrEmpty(decorator.targetMethod))
                {
                    comment += "." + decorator.targetMethod;
                }
            }
            else
            {
                comment += "Empty Decorator";
            }
            //if (decorator.tick > 0)
            //{
            //    comment += ": tick every " + decorator.tick + "s";
            //}
            decorator.comment = comment;
            BehaviorTreesEditor.RepaintAll();
        }
コード例 #4
0
 public void OnDoubleClick(string guid, Rect rect)
 {
     if (UnityEngine.Event.current.type == EventType.MouseDown &&
         UnityEngine.Event.current.clickCount == 2 &&
         rect.Contains(UnityEngine.Event.current.mousePosition))
     {
         BehaviorTreesEditor.ShowEditorWindow();
         BehaviorTreesEditor.SelectBehaviorTrees(target as BehaviorTrees);
     }
 }