123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using CSVReader;
- public class SensorHandler : AbstractSensorHandler
- {
- // Start is called before the first frame update
- ///<summary>
- /// CSV Filename to read from
- ///</summary>
- [SerializeField] string filename;
- ///<summary>
- /// Sensor Prefab to use
- ///</summary>
- [SerializeField] GameObject SensorPrefab;
- ///<summary>
- /// SensorCSV Reader
- ///</summary>
- SensorCSVReader SensorCSV;
- void Start()
- {
- SensorList = new Dictionary<int, GameObject>();
- //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()
- {
- }
- }
|