Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         RaycastHit hit;
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(ray, out hit, 200.0f))
         {
             hitSensor = hit.transform.GetComponent <SensorBase>();
             if (hitSensor != null)
             {
                 SensorManagerBase.Instance.ShowUI(hitSensor.sensorType);
                 Debug.Log("Click on: " + hitSensor.sensorType);
             }
         }
         else
         {
             if (hitSensor != null)
             {
                 SensorManagerBase.Instance.CloseUI(hitSensor.sensorType);
                 Debug.Log(hitSensor.sensorType + " is closing.");
                 hitSensor = null;
             }
         }
     }
 }
Esempio n. 2
0
 public void AddSensor(string sensorType, SensorBase sensorBase)
 {
     if (!this.sensorDic.ContainsKey(sensorType))
     {
         Sensor sensor = new Sensor();
         sensor.sensorList     = new List <SensorBase>();
         sensorDic[sensorType] = sensor;
     }
     sensorDic[sensorType].sensorList.Add(sensorBase);
 }