Example #1
0
   /// <summary>
   /// Default constructor. Sets all local variables to null
   /// </summary>
   public Agent(ref Environment environment, ref MessageQueue messages,
 PointF spawnLocation, int agentID, Image image, Graphics g)
   {
       // Intialise variables
         env = environment;
         // Create a communication node for the agent
         messageQueue = messages;
         messageQueue.Register(this);
         messageQueue.MessageEvent += new MessageQueue.MessageHandler(messageQueue_MessageEvent);
         assignedTask = null;
         this.g = g;
         if (image != null) {
       this.image = image;
       location = spawnLocation;
         }
         coordinationNode = new CoordinationGraphNode(this);
         communicationNode = new CommunicationGraphNode(this);
         // Initialise Agent state variables
         id = agentID;
         rnd = new Random(System.Environment.TickCount);
         lifeCounter = rnd.Next(MIN_LIFE_COUNTER, MAX_LIFE_COUNTER);
   }
 public CoordinationGraphEdge(CoordinationGraphNode sourceNode, CoordinationGraphNode destinationNode)
 {
     source = sourceNode;
       destination = destinationNode;
 }