コード例 #1
0
 public Envalope(Stimulus stim, Configuration config)
 {
     // assign the variables
     source = stim.m_source;
     events = new List <Event>();
     markEnvalopeForDeletion = false;
     Add(stim, config);
 }
コード例 #2
0
        public void Update(Stimulus stim)
        {
            Event foundEvent = events.Find(e => e.m_source == stim.m_source && e.m_type == stim.m_type);  //find matching events with the stimulus

            if (foundEvent != null)
            {
                foundEvent.Update(); // if events can be found, update the envent and the process the envalope
                Process();
            }
        }
コード例 #3
0
 private Configuration GetConfiguration(Stimulus stim)
 {
     foreach (Configuration C in perception_M.configs)
     {
         if (C.type == stim.m_type)
         {
             return(C);
         }
     }
     return(null);
 }
コード例 #4
0
 public Event(Stimulus stim, Configuration config)
 {
     //initialise variables
     this.m_type               = stim.m_type;
     this.m_source             = stim.m_source;
     this.m_location           = stim.m_location;
     this.m_Direction          = stim.m_Direction;
     this.m_Radius             = stim.m_Radius;
     this.configuration        = config;
     this.birth                = Time.time;
     this.markEventForDeletion = false;
 }
コード例 #5
0
 public void AcceptFilteredStimulus(Stimulus stim)
 {
     Debug.Log("type" + stim.m_type + "Source" + stim.m_source); // output the stimulus type and source
     foreach (Envalope E in envalopes)
     {
         if (E.source == stim.m_source)
         {
             if (E.Exists(stim)) // if the stimulus exists in the current envalope envalope
             {
                 E.Update(stim); // update the envalope and send in the currem stimulus
             }
             else
             {
                 E.Add(stim, GetConfiguration(stim));//if the stimulus doesnt exist, add the stimulus into the envalope
             }
         }
     }
     envalopes.Add(new Envalope(stim, GetConfiguration(stim))); // create and add an envalope into the envalopes List
 }
コード例 #6
0
 public bool Exists(Stimulus stim)
 {
     return(events.Exists(e => e.m_source == stim.m_source && e.m_type == stim.m_type)); // if the stimuls exists in the event
 }
コード例 #7
0
 public void Add(Stimulus stim, Configuration config)
 {
     events.Add(new Event(stim, config));
     Process(); // add a new event with the given stimulus and configuration
 }
コード例 #8
0
 public void AcceptStim(Stimulus stim)
 {
     stimBuffer.Add(stim); // ddd the stimulus to the list
 }