Ejemplo n.º 1
0
 public ManufacturerTask(ClientAgent client)
 {
     clientAgent = client;
       supplierAgent = null;
       transportAgent = null;
       agents = new List<TaskComparer>();
 }
Ejemplo n.º 2
0
 public Agent AddNewAgent(AGENT_TYPE agentType, Image image)
 {
     Agent newAgent = null;
       Environment a = this;
       // Set a random location for the agent
       RectangleF bounds = device.Graphics.VisibleClipBounds;
       PointF location = new PointF((float)(bounds.Width * rnd.NextDouble()),
                            (float)(bounds.Height * rnd.NextDouble()));
       switch (agentType) {
     case AGENT_TYPE.AGENT_CONTROLLER: {
     newAgent = new Controller(ref a, ref messageQueue, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_OPERATOR: {
     newAgent = new Operator(ref a, ref messageQueue, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_LOGISTICS: {
     // Logistics Agent
     newAgent = new TransportAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_SUPPLIER: {
     newAgent = new SupplierAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_MANUFACTURE: {
     newAgent = new ManufacturerAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_CLIENT: {
     newAgent = new ClientAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
       }
       agents.Add(newAgent);
       if (NewAgent != null)
     NewAgent(this, ref newAgent);
       return newAgent;
 }