private void enlargedList(string property, int newSize, Type propertyType, Type collectionElementType) { for (int i = sizeToTrack[property][0]; i < newSize; i++) { IMonoBehaviourSensor newSensor = addSensor(sensorNameForCollectionProperty[property], property, 0, propertyType); newSensor.indexes.Add(i); newSensor.collectionElementProperty = currentSubProperty; newSensor.collectionElementType = collectionElementType.Name; newSensor.done(); SensorsManager.GetInstance().addSensor(brain, newSensor); } }
private void configureSensor(object[] result, Type type, SensorConfiguration conf, string property, int currentOperationPerProperty, List <IMonoBehaviourSensor> generatedSensors) { //MyDebugger.MyDebug("configuring sensors for " + property); if (result != null) { type = (Type)result[0]; } if (type != null && currentPropertyType.Equals("VALUE")) { IMonoBehaviourSensor sensor = addSensor(conf.name, property, currentOperationPerProperty, type); //MyDebugger.MyDebug("AND IT'S VALUE"); sensor.done(); generatedSensors.Add(sensor); } else if (type != null) { List <int> currentSize = new List <int>(); if (currentPropertyType.Equals("LIST")) { //MyDebugger.MyDebug("AND IT'S LIST"); currentSize.Add((int)result[1]); for (int i = 0; i < (int)result[1]; i++) { IMonoBehaviourSensor sensor = addSensor(conf.name, property, currentOperationPerProperty, type); sensor.indexes.Add(i); sensor.collectionElementProperty = currentSubProperty; sensor.collectionElementType = ((Type)result[2]).Name; sensor.done(); generatedSensors.Add(sensor); } } else if (currentPropertyType.Equals("ARRAY2")) { MyDebugger.MyDebug("AND IT'S ARRAY2"); currentSize.Add((int)result[1]); currentSize.Add((int)result[2]); for (int i = 0; i < (int)result[1]; i++) { for (int j = 0; j < (int)result[2]; j++) { IMonoBehaviourSensor sensor = addSensor(conf.name, property, currentOperationPerProperty, type); sensor.indexes.Add(i); sensor.indexes.Add(j); sensor.collectionElementProperty = currentSubProperty; sensor.collectionElementType = ((Type)result[3]).Name; sensor.done(); generatedSensors.Add(sensor); } } } if (!sizeToTrack.ContainsKey(property)) { //MyDebugger.MyDebug("property " + property); //MyDebugger.MyDebug("size " + currentSize.Count); sizeToTrack.Add(property, currentSize); typeForCollectionProperty.Add(property, currentPropertyType); elementForCollectionProperty.Add(property, new List <string>()); sensorNameForCollectionProperty.Add(property, conf.name); } elementForCollectionProperty[property].Add(currentSubProperty); } }