c# - Add and use behaviours of agent with saving a flexibility -


there many behaviours in agent, number , consist isn't known beforehand. behaviour algorithm of action in response of events in system or in agent itself. wanted that:

public abstract class abstractbehaviour  {             ... // etc     public abstract void do();  } class concretebehaviour1 : abstractbehaviour  {   ...//fields etc        public void do() { ... }   }  class concretebehaviour2 : abstractbehaviour {       ...//fields etc        public void do() { ... }  } public class agent : iagent {     private dictionary<string, abstractbehaviour> behaviours;     private type1 field1;     private type2 firld2;     public void algorithm( ... )     {         behaviours[neccessarybehaviour1].do();         agent.filed1 = behaviours[neccessarybehaviour1].getdata();         behaviours[neccessarybehaviour111].do();         agent.filed2 = behaviours[neccessarybehaviour111].getdata();         ...     } } 

the problem cant neccessary data behaviours. tell mechanism can used saving flexibility , getting neccessary data @ once? want save probability of adding functionality agents.


Comments