using System; namespace Passer.Control.Core { public class DistanceSensor : Thing { public float distance = 0; public DistanceSensor() : base(true) { } public DistanceSensor(byte networkId, byte thingId) : base(null, networkId, thingId, (byte)Type.TemperatureSensor) { } #if UNITY_5_3_OR_NEWER public override void CreateComponent() { this.component = Unity.DistanceSensor.Create(this.parent); this.component.core = this; } #endif public override void ProcessBinary(byte[] bytes) { byte ix = 0; this.distance = LowLevelMessages.ReceiveFloat16(bytes, ref ix); } } }