Compliency fixes
This commit is contained in:
parent
a5664dea9d
commit
f3b863692b
@ -44,10 +44,10 @@ namespace RoboidControl.Unity {
|
|||||||
// before we can create the wheel reliably
|
// before we can create the wheel reliably
|
||||||
break;
|
break;
|
||||||
case RoboidControl.Thing coreThing:
|
case RoboidControl.Thing coreThing:
|
||||||
Debug.Log("Handle Thing");
|
// Debug.Log("Handle Thing");
|
||||||
if (coreThing.component == null) {
|
if (coreThing.component == null) {
|
||||||
Thing[] things = FindObjectsByType<Thing>(FindObjectsSortMode.None);
|
Thing[] things = FindObjectsByType<Thing>(FindObjectsSortMode.None);
|
||||||
Debug.Log(things.Length);
|
// Debug.Log(things.Length);
|
||||||
Thing thing = things.FirstOrDefault(t => t.core != null && t.core.id == coreThing.id);
|
Thing thing = things.FirstOrDefault(t => t.core != null && t.core.id == coreThing.id);
|
||||||
if (thing == null)
|
if (thing == null)
|
||||||
thing = Thing.Create(coreThing);
|
thing = Thing.Create(coreThing);
|
||||||
|
@ -30,7 +30,7 @@ namespace RoboidControl.Unity {
|
|||||||
while (site.updateQueue.TryDequeue(out RoboidControl.Participant.UpdateEvent e))
|
while (site.updateQueue.TryDequeue(out RoboidControl.Participant.UpdateEvent e))
|
||||||
HandleUpdateEvent(e);
|
HandleUpdateEvent(e);
|
||||||
|
|
||||||
site.Update((ulong)(Time.time * 1000));
|
site.Update();
|
||||||
// while (thingQueue.TryDequeue(out RoboidControl.Thing thing))
|
// while (thingQueue.TryDequeue(out RoboidControl.Thing thing))
|
||||||
// thing.CreateComponent();
|
// thing.CreateComponent();
|
||||||
}
|
}
|
||||||
|
@ -212,10 +212,9 @@ namespace RoboidControl.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
ScanForThings(parentTransform);
|
ScanForThings(parentTransform);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
this.transform.localScale = Vector3.one * 1;
|
this.transform.localScale = Vector3.one * 1;
|
||||||
}
|
}
|
||||||
@ -230,7 +229,7 @@ namespace RoboidControl.Unity {
|
|||||||
for (int thingIx = 0; thingIx < thingArray.Length; thingIx++) {
|
for (int thingIx = 0; thingIx < thingArray.Length; thingIx++) {
|
||||||
RoboidControl.Thing thing = thingArray[thingIx];
|
RoboidControl.Thing thing = thingArray[thingIx];
|
||||||
GameObject foundObj = FindThingByName(thing, rootTransform);
|
GameObject foundObj = FindThingByName(thing, rootTransform);
|
||||||
if (foundObj != null && foundObj != thing.component.gameObject) {
|
if (foundObj != null && (thing.component != null && foundObj != thing.component.gameObject)) {
|
||||||
Thing foundThing = foundObj.GetComponent<Thing>();
|
Thing foundThing = foundObj.GetComponent<Thing>();
|
||||||
if (foundThing == null) {
|
if (foundThing == null) {
|
||||||
Debug.Log($"move thing [{thing.owner.networkId}/{thing.id}] to {foundObj.name}");
|
Debug.Log($"move thing [{thing.owner.networkId}/{thing.id}] to {foundObj.name}");
|
||||||
@ -242,6 +241,9 @@ namespace RoboidControl.Unity {
|
|||||||
Destroy(thing.component.gameObject);
|
Destroy(thing.component.gameObject);
|
||||||
thing.component = foundThing;
|
thing.component = foundThing;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Debug.LogWarning($"Could not find [{thing.owner.networkId}/{thing.id}]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace RoboidControl {
|
|||||||
float horizontal = ReceiveAngle8(data, ref ix);
|
float horizontal = ReceiveAngle8(data, ref ix);
|
||||||
float vertical = ReceiveAngle8(data, ref ix);
|
float vertical = ReceiveAngle8(data, ref ix);
|
||||||
float twist = ReceiveAngle8(data, ref ix);
|
float twist = ReceiveAngle8(data, ref ix);
|
||||||
System.Console.Write($"receive st: {horizontal} {vertical} {twist}");
|
// System.Console.Write($"receive st: {horizontal} {vertical} {twist}");
|
||||||
|
|
||||||
SwingTwist r = SwingTwist.Degrees(horizontal, vertical, twist);
|
SwingTwist r = SwingTwist.Degrees(horizontal, vertical, twist);
|
||||||
return r;
|
return r;
|
||||||
|
@ -163,6 +163,7 @@ namespace RoboidControl {
|
|||||||
/// The thing relevant fo the event
|
/// The thing relevant fo the event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Thing thing;
|
public Thing thing;
|
||||||
|
public Participant participant;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queue containing events happened to this participant
|
/// Queue containing events happened to this participant
|
||||||
|
@ -401,7 +401,7 @@ namespace RoboidControl {
|
|||||||
|
|
||||||
protected virtual void Process(Participant sender, PoseMsg msg) {
|
protected virtual void Process(Participant sender, PoseMsg msg) {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Console.WriteLine($"{this.name}: Process PoseMsg [{msg.networkId}/{msg.thingId}] {msg.poseType}");
|
// Console.WriteLine($"{this.name}: Process PoseMsg [{msg.networkId}/{msg.thingId}] {msg.poseType}");
|
||||||
#endif
|
#endif
|
||||||
Participant owner = Participant.GetParticipant(msg.networkId);
|
Participant owner = Participant.GetParticipant(msg.networkId);
|
||||||
if (owner == null)
|
if (owner == null)
|
||||||
|
@ -104,7 +104,8 @@ namespace RoboidControl {
|
|||||||
// this.Send(sender, new NetworkIdMsg(sender.networkId));
|
// this.Send(sender, new NetworkIdMsg(sender.networkId));
|
||||||
sender.Send(new NetworkIdMsg(sender.networkId));
|
sender.Send(new NetworkIdMsg(sender.networkId));
|
||||||
UpdateEvent e = new() {
|
UpdateEvent e = new() {
|
||||||
messageId = ParticipantMsg.Id
|
messageId = ParticipantMsg.Id,
|
||||||
|
participant = sender
|
||||||
};
|
};
|
||||||
this.updateQueue.Enqueue(e);
|
this.updateQueue.Enqueue(e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user