/// <summary> /// Change the sensor range /// </summary> /// <param name="distance"></param> /// <param name="isEditing"></param> public override void SetSensorRange(float distance, bool isEditing) { if (isEditing && !main.IsMetric) { distance = AuxFunctions.ToMeter(distance); } MaxRange = distance; }
/// <summary> /// Set the offset between emitter & receiver /// </summary> /// <param name="distance"></param> /// <param name="isEditing"></param> public override void SetSensorRange(float distance, bool isEditing = false) { //Convert the distance pass in as meter so the position of emitter & transmitter will be set properly if (isEditing && !main.IsMetric) { distance = AuxFunctions.ToMeter(distance); } Emitter.transform.localPosition = new Vector3(0, 0, -distance / 2); Receiver.transform.localPosition = new Vector3(0, 0, distance / 2); sensorOffset = distance; }