using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using CSVReader;
public class SensorHandler : AbstractSensorHandler
{
// Start is called before the first frame update
///
/// CSV Filename to read from
///
[SerializeField] string filename;
///
/// Sensor Prefab to use
///
[SerializeField] GameObject SensorPrefab;
///
/// SensorCSV Reader
///
SensorCSVReader SensorCSV;
void Start()
{
SensorList = new Dictionary();
//Create new SensorCSV Reader
SensorCSV = new SensorCSVReader(filename);
//Read Sensors
SensorObject[] sensors = SensorCSV.ReadFile();
//create sensor objects
foreach (SensorObject sensor in sensors)
{
GameObject sensorObject = Instantiate(SensorPrefab);
sensorObject.transform.position = sensor.Pos;
sensorObject.transform.eulerAngles = sensor.Rot;
sensorObject.name = "Sensor" + sensor.ID;
SensorList.Add(sensor.ID,sensorObject);
}
}
// Update is called once per frame
void Update()
{
}
}