public SensorArray(CommunicationTypes communicationTypes, BumpSensorLocations bumpSensorLocations) { communicationArray = new CommunicationArray(communicationTypes); bumpSensors = new BumpSensors(bumpSensorLocations); bumpSensors.OnBump += new EventHandler <BumpEventArgs>(Bump); }
public BumpSensors(BumpSensorLocations bumpSensorLocations) { bumpSensors = new List <BumpSensor>(); if ((bumpSensorLocations & BumpSensorLocations.Back) != 0) { bumpSensors.Add(new BumpSensor(BumpSensorLocation.Back)); } if ((bumpSensorLocations & BumpSensorLocations.Front) != 0) { bumpSensors.Add(new BumpSensor(BumpSensorLocation.Front)); } if ((bumpSensorLocations & BumpSensorLocations.Left) != 0) { bumpSensors.Add(new BumpSensor(BumpSensorLocation.Left)); } if ((bumpSensorLocations & BumpSensorLocations.Right) != 0) { bumpSensors.Add(new BumpSensor(BumpSensorLocation.Right)); } // this is in case the bumpsensors themselves get code to invoke the bump foreach (BumpSensor bumpSensor in bumpSensors) { bumpSensor.OnBump += Bump; } }
/// <summary> /// Constructor /// </summary> /// <param name="id">The bots ID</param> /// <param name="communicationType">The bots communication type</param> /// <param name="bumpSensorLocations"></param> public EPROM(Guid id, CommunicationTypes communicationType, BumpSensorLocations bumpSensors) { this.communicationType = communicationType; this.bumpSensors = bumpSensors; this.id = id; FileHelper.SaveROM(id, this); history = new History(); }