Added touch sensor support to siteserver
This commit is contained in:
parent
56edf36785
commit
5a4daea34a
@ -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) {
|
||||||
|
@ -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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user