protected override void Action() { DFAgentDescription dfAgentDescription = new DFAgentDescription(); dfAgentDescription.AgentId = Agent.AId; DFServiceDescription collectWoodServiceDescription = new DFServiceDescription(); collectWoodServiceDescription.Type = WorkVocabulary.WORK; collectWoodServiceDescription.Name = WorkVocabulary.COLLECT_WOOD_SERVICE; DFServiceDescription collectStoneServiceDescription = new DFServiceDescription(); collectStoneServiceDescription.Type = WorkVocabulary.WORK; collectStoneServiceDescription.Name = WorkVocabulary.COLLECT_STONE_SERVICE; dfAgentDescription.AddService(collectStoneServiceDescription); dfAgentDescription.AddService(collectWoodServiceDescription); DFService.RegisterService(Agent, dfAgentDescription); }
// ----------------------- private void registerChaseService() { DFAgentDescription dfAgentDescription = new DFAgentDescription(); dfAgentDescription.AgentId = AId; DFServiceDescription serviceDescription = new DFServiceDescription(); serviceDescription.Type = ChaseVocabulary.CHASE_TYPE; serviceDescription.Name = ChaseVocabulary.CHASE_SERVICE; dfAgentDescription.AddService(serviceDescription); DFService.RegisterService(this, dfAgentDescription); }
override protected void Action() { DFAgentDescription dfAgentDescription = new DFAgentDescription(); DFServiceDescription serviceDescription = new DFServiceDescription(); serviceDescription.Type = WorkVocabulary.WORK; serviceDescription.Name = WorkVocabulary.COLLECT_STONE_SERVICE; dfAgentDescription.AddService(serviceDescription); Action <AgentDescriptionListConcept> action = delegate(AgentDescriptionListConcept concept) { List <DFAgentDescription> agents = concept.AgentDescriptions.FindAll(agentDescription => canAgentBeRequested(agentDescription)); if (agents.Count != 0) { requestCollectingStone(agents.First().AgentId); } }; DFService.RequestSearch(coordinatorAgent, dfAgentDescription, action); }
override protected void Action() { DFAgentDescription dfAgentDescription = new DFAgentDescription(); DFServiceDescription serviceDescription = new DFServiceDescription(); serviceDescription.Type = ChaseVocabulary.CHASE_TYPE; serviceDescription.Name = ChaseVocabulary.CHASE_SERVICE; dfAgentDescription.AddService(serviceDescription); Action <AgentDescriptionListConcept> action = delegate(AgentDescriptionListConcept concept) { foreach (DFAgentDescription agentDescription in concept.AgentDescriptions) { AgentMessage message = new AgentMessage(AgentMessage.PerformativeType.INFORM); message.Receiver = agentDescription.AgentId; message.Ontology = ChaseVocabulary.CHASE_ONTOLOGY; message.Content = new PlayerPositionConcept(position); Agent.Send(message); } }; DFService.RequestSearch(Agent, dfAgentDescription, action); }