Exemple #1
0
        public void RestartChild(BehaviourNode child)
        {
            if (!Children.Contains(child))
            {
                throw new System.Exception("Not parent of this child!");
            }

            if (child.Result == true)
            {
                m_succeededCount--;
            }
            else
            {
                m_failedCount--;
            }
            child.StartNode();
        }
        /*
         * private void DrawBehaviourTree(Debugger debugger)
         * {
         *  EditorGUILayout.BeginVertical();
         *  {
         *      GUILayout.Label("Behaviour Tree:", EditorStyles.boldLabel);
         *
         *      EditorGUILayout.BeginVertical(nestedBoxStyle);
         *      DrawNodeTree(debugger.BehaviorTree, 0);
         *      EditorGUILayout.EndVertical();
         *  }
         *  EditorGUILayout.EndVertical();
         * }
         */

        protected override void DrawNodeButtons(BehaviourNode node)
        {
            if (node.State == BehaviourNode.NodeState.ACTIVE)
            {
                if (GUILayout.Button("stop", EditorStyles.miniButton))
                {
                    node.RequestStopNode();
                }
            }
            else if (node is BehaviourRootNode && node.State == BehaviourNode.NodeState.INACTIVE)
            {
                GUI.color = new Color(1f, 1f, 1f, 1f);
                if (GUILayout.Button("start", EditorStyles.miniButton))
                {
                    node.StartNode();
                }
                GUI.color = new Color(1f, 1f, 1f, 0.3f);
            }
        }