Multiple ant support
This commit is contained in:
parent
3e5da90f47
commit
78aed40a9b
@ -134,7 +134,9 @@ namespace Passer.Control.Core {
|
|||||||
this.nextPublishMe = currentTimeMS + this.publishInterval;
|
this.nextPublishMe = currentTimeMS + this.publishInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Thing thing in this.things) {
|
int n = this.things.Count;
|
||||||
|
for (int ix = 0; ix < n; ix++) {
|
||||||
|
Thing thing = this.things[ix];
|
||||||
if (thing != null && thing.parent == null) // update only root things
|
if (thing != null && thing.parent == null) // update only root things
|
||||||
thing.Update(currentTimeMS);
|
thing.Update(currentTimeMS);
|
||||||
}
|
}
|
||||||
|
@ -31,13 +31,17 @@ namespace Passer.Control.Core {
|
|||||||
Thing foundThing = Get(thing.networkId, thing.id);
|
Thing foundThing = Get(thing.networkId, thing.id);
|
||||||
|
|
||||||
if (foundThing == null) {
|
if (foundThing == null) {
|
||||||
// if (thing.id == 0)
|
|
||||||
// thing.id = (byte)(things.Count + 1);
|
|
||||||
things.Add(thing);
|
things.Add(thing);
|
||||||
|
|
||||||
if (invokeEvent)
|
if (invokeEvent)
|
||||||
Thing.InvokeNewThing(thing);
|
Thing.InvokeNewThing(thing);
|
||||||
// Console.Write($"Add thing {ipAddress}:{port}[{networkId}/{thing.id}]");
|
// Console.Write($"Add thing {ipAddress}:{port}[{networkId}/{thing.id}]");
|
||||||
|
} else {
|
||||||
|
if (thing != foundThing) {
|
||||||
|
// should be: find first non-existing id...
|
||||||
|
thing.id = (byte)this.things.Count;
|
||||||
|
things.Add(thing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace Passer.Control.Unity {
|
|||||||
GameObject distanceObj = new("Distance sensor");
|
GameObject distanceObj = new("Distance sensor");
|
||||||
DistanceSensor component = distanceObj.AddComponent<DistanceSensor>();
|
DistanceSensor component = distanceObj.AddComponent<DistanceSensor>();
|
||||||
if (parent != null && parent.component != null)
|
if (parent != null && parent.component != null)
|
||||||
distanceObj.transform.SetParent(parent.component.transform);
|
distanceObj.transform.SetParent(parent.component.transform, false);
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ namespace Passer.Control.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void HandleNewThing(Core.Thing thing) {
|
public void HandleNewThing(Core.Thing thing) {
|
||||||
|
site.Add(thing, false);
|
||||||
thingQueue.Enqueue(thing);
|
thingQueue.Enqueue(thing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +32,6 @@ namespace Passer.Control.Unity {
|
|||||||
thing.CreateComponent();
|
thing.CreateComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user