/** @brief Sends diffents messages types to state components * * @param agentName The agent to send the message * @param msgType The type of message * @param content The content of the message * @return True if the message has been successfully sent */ public bool SendMsg(string stateName, object value, Agent sender = null, AgentManager.MsgType msgType = AgentManager.MsgType.STARDAR_MSG) { List <State> states = FindState(stateName); if (states.Count == 0) { Debug.LogWarningFormat("The state {0} was not found to sent the message.", stateName); return(false); } if (msgType == AgentManager.MsgType.INTERRUPTING_MSG) { foreach (State state in states) { // It is needed to update changes made by the messages before checking transitions state.Layer.ActiveInterruptingState(state, value, sender); } } else { foreach (State state in states) { state.Layer.SendStandarMessage(state, value, sender); } } return(true); }
/** @brief Sends diffents messages types to state components * * @param agentName The agent to send the message * @param msgType The type of message * @param content The content of the message * @return True if the message has been successfully sent */ public bool SendMsg(string stateName, int layerId, object value, Agent sender = null, AgentManager.MsgType msgType = AgentManager.MsgType.STARDAR_MSG) { State state = FindState(stateName, layerId); if (state == null) { Debug.LogWarningFormat("The state {0} was not found to sent the message.", stateName); return(false); } if (msgType == AgentManager.MsgType.INTERRUPTING_MSG) { state.Layer.ActiveInterruptingState(state, value, sender); } else { state.Layer.SendStandarMessage(state, value, sender); } return(true); }