34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
namespace Passer.RoboidControl {
|
|
|
|
/// <summary>
|
|
/// A sensor which can detect touches
|
|
/// </summary>
|
|
public class TouchSensor : Thing {
|
|
/// <summary>
|
|
/// Value which is true when the sensor is touching something, false otherwise
|
|
/// </summary>
|
|
public bool touchedSomething = false;
|
|
|
|
/// <summary>
|
|
/// Create a touch sensor
|
|
/// </summary>
|
|
/// <param name="participant">The participant for with the sensor is needed</param>
|
|
/// <param name="invokeEvent">True when the creation should trigger an event</param>
|
|
public TouchSensor(RemoteParticipant participant, bool invokeEvent = true) : base(participant, invokeEvent) {
|
|
touchedSomething = false;
|
|
}
|
|
|
|
public TouchSensor(RemoteParticipant participant, byte networkId, byte thingId) : base(participant, networkId, thingId) {
|
|
touchedSomething = false;
|
|
}
|
|
|
|
#if UNITY_5_3_OR_NEWER
|
|
/// @copydoc Passer::RoboidControl::Thing::CreateComponent
|
|
public override void CreateComponent() {
|
|
System.Console.Write("Create touch sensor component");
|
|
this.component = Unity.TouchSensor.Create(this);
|
|
this.component.core = this;
|
|
}
|
|
#endif
|
|
}
|
|
} |