Exemplo n.º 1
0
        /// <summary>
        /// Performs an action on a certain agent, the method is frozen until the action has completed.
        /// </summary>
        /// <param name="action">The action that is being performed</param>
        public void performAction(EntityXmasAction action)
        {
            action.Resolved += action_Completed;
            agent.QueueAction(action);

            actionComplete.WaitOne();

            PerceptCollection activepercepts = null;
            lock (this)
            {
                activepercepts = newpercepts;
                newpercepts = null;
            }

            if (PerceptsRecieved != null && activepercepts != null && action.ActionFailed == false)
            {
                PerceptsRecieved(this, new UnaryValueEvent<PerceptCollection>(activepercepts));
            }
        }
Exemplo n.º 2
0
 private void agent_RetrievePercepts(RetreivePerceptsEvent e)
 {
     lock (this)
     {
         newpercepts = e.Percepts;
     }
 }