private void sendCancelMessage(ScheduledJob job) { AgentMessage message = new AgentMessage(AgentMessage.PerformativeType.CANCEL); message.Sender = coordinatorAgent.AId; message.Receiver = job.AgentId; message.Protocol = Protocols.FIPA_REQUEST; message.Content = job.Action; message.ConversationId = job.ConversationId; coordinatorAgent.Send(message); job.JobStatus = ScheduledJob.Status.Cancelled; }
private void requestCollectingStone(AgentId agentId) { string conversationId = "stone_" + agentId.GetGlobalName() + "_" + Time.fixedTime; int totalStoneCount = RPGAgentTools.FindObjectsOfType <StorageComponent> ().Select(component => component.GetStoneCount()).Sum(); int amount = controller.StoneToCollect - totalStoneCount; AgentAction action = new GetMaterialAction(new MaterialConcept(MaterialConcept.MaterialType.Stone), amount); AgentMessage message = new AgentMessage(AgentMessage.PerformativeType.REQUEST); message.Sender = coordinatorAgent.AId; message.Receiver = agentId; message.Protocol = Protocols.FIPA_REQUEST; message.Content = action; message.ConversationId = conversationId; ScheduledJob job = new ScheduledJob(agentId, action, conversationId); coordinatorAgent.ScheduledJobs.Add(job); coordinatorAgent.Send(message); }