Example #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);
        }
Example #2
0
        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);
        }
Example #3
0
        public override void OnInspectorGUI()
        {
            string name        = decorator.Name;
            string description = string.IsNullOrEmpty(decorator.comment) ? name : decorator.comment;

            BehaviorTreesEditorUtility.BeginInspectorGUI(ref name, ref description);
            if (name != decorator.Name)
            {
                decorator.Name = name;
                //AssetCreator.SaveAIAsset();
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Target Code", false))
            {
                BehaviorTreesEditorUtility.DrawTargetScript(OnSelected, serializedObject);
                if (decorator.targetScript != null && BehaviorTreesEditorUtility.DrawTargetMethod(decorator.targetScript.GetType(), typeof(bool), ref decorator.targetMethod))
                {
                    UpdateName("Decorator");
                    UpdateComment();
                    AssetCreator.SaveAIAsset();
                    EditorGUILayout.Space();
                }
            }
            GUILayout.Space(7f);
            if (BehaviorTreesEditorUtility.DrawHeader("Key Query", false))
            {
                DrawInverseCondition();
            }
            //GUILayout.Space(7f);
            //if (BehaviorTreesEditorUtility.DrawHeader("Observer Aborts", false))
            //{
            //    DrawTick();
            //}
            BehaviorTreesEditorUtility.EndInspectorGUI(decorator);
        }
Example #4
0
        //protected void DrawTick()
        //{
        //    GUILayout.BeginHorizontal();
        //    GUILayout.Space(7f);
        //    float tick = EditorGUILayout.FloatField("Tick", decorator.tick);
        //    if (tick != decorator.tick)
        //    {
        //        if (tick < 0)
        //        {
        //            tick = 0;
        //        }
        //        decorator.tick = tick;
        //        UpdateComment();
        //        AssetCreator.SaveAIAsset();
        //    }
        //    GUILayout.EndHorizontal();
        //}

        protected void DrawInverseCondition()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(7f);
            GUILayout.Label("Inverse Condition:");
            bool inversed = EditorGUILayout.Toggle(decorator.inversed);

            if (inversed != decorator.inversed)
            {
                decorator.inversed = inversed;
                UpdateComment();
                AssetCreator.SaveAIAsset();
            }
            GUILayout.EndHorizontal();
        }
Example #5
0
        private void DrawTick()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(7f);
            float tick = EditorGUILayout.FloatField("Interval", service.tick);

            if (tick != service.tick)
            {
                // tick 이 0이면 한번만 실행 하도록.
                //if (tick <= 0)
                //    tick = 0.1f;
                service.tick = tick;
                UpdateComment();
                AssetCreator.SaveAIAsset();
            }
            GUILayout.EndHorizontal();
        }
Example #6
0
        private void DrawTick()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(7f);
            float tick = EditorGUILayout.FloatField("Tick", wait.tick);

            if (tick != wait.tick)
            {
                if (tick <= 0)
                {
                    tick = 0.1f;
                }
                wait.tick = tick;
                UpdateComment();
                AssetCreator.SaveAIAsset();
            }
            GUILayout.EndHorizontal();
        }