public void Trigger() { IoTManager.Broadcast(new IoTEvent { from = this, data = 1, what = "Audio threshold exceeded!" }); }
private void Awake() { Instance = this; var transforms = Enumerable.Concat( sensors.ConvertAll(s => s.transform), consumers.ConvertAll(c => c.transform)); transforms.ForEach(t => t.SetParent(transform)); }
private void OnEnable() { IoTManager.Add(this); RaycastHit hitInfo; Collider[] cols; cols = OverlapSphere(transform.position, 0.1f, LayerMask.GetMask("Room")); if (cols.Length > 0) { location = cols[0].transform.name; } else { location = "Outside"; } }
// Update is called once per frame void Update() { var sensors = from s in IoTManager.sensors where s is TestIoTSensor select s as TestIoTSensor; foreach (var s in sensors) { if (s.RunTime > 3) { s.TimeReset(); IoTManager.Broadcast(new IoTEvent { from = s, data = null, what = "Three seconds passed." }); } } }
private void OnDisable() { IoTManager.Remove(this); }