/// <summary> /// Определяет какое из состояний будет состоянием по умолчанию. /// </summary> public void DefaultStateIs(string aStateName) { defaultState = FindState(aStateName); if (defaultState == null) { AntLog.Report("AIControl", "Can't set \"{0}\" as Default State because it is not existing!", aStateName); } }
/// <summary> /// Определяет какое из состояний будет состоянием по умолчанию. /// </summary> public void DefaultStateIs(string aStateName) { defaultState = FindState(aStateName); if (defaultState == null) { AntLog.Report("AntAIAgent", "Can't set \"{0}\" as <b>Default State</b> because it is not existing!", aStateName); } }
public AntAICondition defaultGoal; // Цель по умолчанию. public AntAIAgent() { sense = null; currentState = null; defaultState = null; worldState = new AntAICondition(); planner = new AntAIPlanner(); currentPlan = new AntAIPlan(); currentGoal = null; }
/// <summary> /// Устанавливает состояение по умолчанию как текущее. /// </summary> public void SetDefaultState() { if (currentState != null) { currentState.Stop(); } AntLog.Assert(defaultState == null, "Default <b>State</b> is not defined!", true); currentState = defaultState; currentState.Reset(); currentState.Start(); }
/// <summary> /// Устанавливает состояение по умолчанию как текущее. /// </summary> public void SetDefaultState() { if (currentState != null) { currentState.Stop(); } if (defaultState != null) { currentState = defaultState; currentState.Reset(); currentState.Start(); } else { AntLog.Report("AIControl", "Default State not defined!"); } }
/// <summary> /// Устанавливает указанное состояние как текущее. /// </summary> public void SetState(string aStateName, bool aForce = false) { if (aForce || !string.Equals(currentState.name, aStateName)) { currentState.Stop(); currentState = FindState(aStateName); if (currentState != null) { currentState.Reset(); currentState.Start(); } else { AntLog.Report("AntAIAgent", "Can't find \"{0}\" state.", aStateName); SetDefaultState(); } } }
/// <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); }