Added touch sensor support to siteserver

This commit is contained in:
Pascal Serrarens 2025-04-24 17:23:37 +02:00
parent 56edf36785
commit 5a4daea34a
2 changed files with 12 additions and 2 deletions

View File

@ -67,9 +67,9 @@ namespace RoboidControl.Unity {
} }
private void OnTriggerEnter(Collider other) { private void OnTriggerEnter(Collider other) {
Debug.Log("Touch?"); // Debug.Log("Touch?");
if (other.isTrigger) { if (other.isTrigger) {
Debug.Log($" was trigger {other.name}"); // Debug.Log($" was trigger {other.name}");
return; return;
} }
if (this.transform.root == other.transform.root) { if (this.transform.root == other.transform.root) {

View File

@ -104,7 +104,16 @@ namespace RoboidControl {
protected override void Process(Participant sender, ThingMsg msg) { protected override void Process(Participant sender, ThingMsg msg) {
Console.WriteLine($"SiteServer: Process thing [{msg.networkId}/{msg.thingId}] {msg.thingType} {msg.parentId} "); Console.WriteLine($"SiteServer: Process thing [{msg.networkId}/{msg.thingId}] {msg.thingType} {msg.parentId} ");
Thing thing = sender.Get(msg.networkId, msg.thingId); Thing thing = sender.Get(msg.networkId, msg.thingId);
if (thing == null) {
switch (msg.thingType) {
case (byte)Thing.Type.TouchSensor:
new TouchSensor(sender, msg.networkId, msg.thingId);
break;
}
}
if (thing == null) if (thing == null)
thing = new Thing(sender, msg.networkId, msg.thingId, msg.thingType); thing = new Thing(sender, msg.networkId, msg.thingId, msg.thingType);
@ -119,6 +128,7 @@ namespace RoboidControl {
} }
} }
#endregion Receive #endregion Receive
} }