Exemple #1
0
        // ---

        private AntAIDebuggerNode AddNode(string aText, float aWidth, float aHeight,
                                          GUIStyle aStyle, GUIStyle aActiveStyle, ref Vector2 aPosition, bool aAddToList = true)
        {
            AntAIDebuggerNode node = new AntAIDebuggerNode(aPosition.x, aPosition.y, aWidth, aHeight, aStyle, aActiveStyle);

            node.title = aText;
            if (aAddToList)
            {
                _nodes.Add(node);
            }
            aPosition.x += aWidth;
            return(node);
        }
Exemple #2
0
        /// <summary>
        /// Обновляет информацию уже существующей ноды описывающей состояние мира (условий ИИ).
        /// </summary>
        private void UpdateWorldStateNode(AntAICondition aCondition, AntAIDebuggerNode aNode)
        {
            List <string> desc = new List <string>();

            desc.Add(string.Format("<b><color={0}>WORLD STATE</color></b>", _titleColor));
            desc.Add("   <b>Current Conditions</b>");
            DescribeCondition(aCondition, ref desc);

            StringBuilder text = new StringBuilder();

            for (int i = 0, n = desc.Count; i < n; i++)
            {
                text.AppendLine(desc[i]);
            }

            aNode.title       = text.ToString();
            aNode.rect.height = CalcHeight(desc.Count);
        }
Exemple #3
0
        /// <summary>
        /// Создает ноду состояния.
        /// </summary>
        private AntAIDebuggerNode CreateStateNode(AntAIState aState, Vector2 aNodePosition, bool isDefault)
        {
            string title;
            float  height = 40.0f;

            if (isDefault)
            {
                title = string.Format("<b><color={1}>STATE</color> '<color={2}>{0}</color>'</b>\n\r   <color=#51a9b0>This is Default state</color>",
                                      aState.name, _titleColor, _nameColor);
                height += 14.0f;
            }
            else
            {
                title = string.Format("<b><color={1}>STATE</color> '<color={2}>{0}</color>'</b>",
                                      aState.name, _titleColor, _nameColor);
            }

            AntAIDebuggerNode node = AddNode(title, 220.0f, height, _stateStyle, _stateStyle, ref aNodePosition);

            node.value = aState.name;
            return(node);
        }
Exemple #4
0
        /// <summary>
        /// Обновляет ноду описывающую конкретное действие из плана ИИ.
        /// </summary>
        private void UpdatePlanNode(AntAIAction aAction, AntAICondition aConditions,
                                    AntAICondition aPrevConditions, AntAIDebuggerNode aNode)
        {
            AntAICondition condCopy = aConditions.Clone();

            condCopy.name = aAction.name;
            aNode.value   = aAction.state;

            int numLines;

            aNode.title       = DescribePlanAction(condCopy, aPrevConditions, out numLines);
            aNode.rect.height = CalcHeight(numLines);

            if (_currentPlan.isSuccess)
            {
                aNode.defaultNodeStyle = (aAction.name.Equals(_agent.currentPlan[0])) ? _activePlanStyle : _planStyle;
            }
            else
            {
                aNode.defaultNodeStyle = (aAction.name.Equals(_agent.currentPlan[0])) ? _activeFailedPlanStyle : _failedPlanStyle;
            }
        }
Exemple #5
0
        private void RebuildBlackboardNode(Vector2 aNodePosition)
        {
            if (_blackboard != null)
            {
                var desc = new List <string>();
                desc.Add(string.Format("<b><color={0}>BLACKBOARD</color></b>", _titleColor));
                desc.Add("   <b>Properties</b>");

                DescribeBlackboard(ref desc);

                StringBuilder text = new StringBuilder();
                for (int i = 0, n = desc.Count; i < n; i++)
                {
                    text.AppendLine(desc[i]);
                }

                _blackboardNode = AddNode(text.ToString(), 440.0f, CalcHeight(desc.Count), _nodeStyle, _nodeStyle, ref aNodePosition);
            }
            else
            {
                var desc = string.Format("<b><color={0}>BLACKBOARD</color></b>\n\r   <color=white>Not exists!</color>", _titleColor);
                _blackboardNode = AddNode(desc, 440.0f, CalcHeight(2), _nodeStyle, _nodeStyle, ref aNodePosition);
            }
        }
 public void LinkTo(AntAIDebuggerNode aNode, Color aColor)
 {
     links.Add(new KeyValuePair <AntAIDebuggerNode, Color>(aNode, aColor));
 }