/// <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)); } }
private void agent_RetrievePercepts(RetreivePerceptsEvent e) { lock (this) { newpercepts = e.Percepts; } }