/// <summary> /// Описывает состояние. /// </summary> private void DescribeCondition(AntAICondition aCondition, ref List <string> aResult) { bool value; for (int i = 0; i < AntAIPlanner.MAX_ATOMS; i++) { if (aCondition.GetMask(i)) { value = aCondition.GetValue(i); aResult.Add(string.Format(" '<color={2}>{0}</color>' = <color={2}>{1}</color>", _agent.planner.atoms[i], value, (value) ? _trueColor : _falseColor)); } } }
public void BindData(string aTitle, AntAIPlanner aPlanner, AntAICondition aCur, AntAICondition aPre) { title = string.Concat("▶ ", aTitle); _items = new List <Item>(); bool v; for (int i = 0, n = AntAIPlanner.MAX_ATOMS; i < n; i++) { if (aCur.GetMask(i)) { v = aCur.GetValue(i); _items.Add(new Item { name = aPlanner.atoms[i], value = v, isChanged = (v != aPre.GetValue(i)) }); } } }
/// <summary> /// Описывает конкретное действие из плана ИИ. /// </summary> private string DescribePlanAction(AntAICondition aCur, AntAICondition aPre, out int aNumLines) { var lines = new List <string>(); lines.Add(string.Format("<b><color={1}>ACTION</color> '<color={2}>{0}</color>'</b>", aCur.name, _titleColor, _nameColor)); lines.Add(" <b>Post Conditions</b>"); bool value; for (int j = 0; j < AntAIPlanner.MAX_ATOMS; j++) { if (aCur.GetMask(j)) { value = aCur.GetValue(j); if (value != aPre.GetValue(j)) { lines.Add(string.Format(" <color=#a873dd><b>></b></color> <i>'<color={2}>{0}</color>' = <color={2}>{1}</color></i>", _agent.planner.atoms[j], value, (value) ? _trueColor : _falseColor)); } else { lines.Add(string.Format(" '<color={2}>{0}</color>' = <color={2}>{1}</color>", _agent.planner.atoms[j], value, (value) ? _trueColor : _falseColor)); } } } StringBuilder text = new StringBuilder(); for (int i = 0, n = lines.Count; i < n; i++) { text.AppendLine(lines[i]); } aNumLines = lines.Count; return(text.ToString()); }