Compare commits

..

No commits in common. "3d2374436c10bab43a85c2177f174fb530f751c4" and "fd8215cc7e8dbd871111bd5831f8610a4b1bb5f1" have entirely different histories.

5 changed files with 8 additions and 28 deletions

View File

@ -66,7 +66,7 @@ namespace RoboidControl.Unity {
/// </summary>
protected virtual void Update() {
if (core == null) {
// Debug.Log("Core thing is gone, self destruct in 0 seconds...");
Debug.Log("Core thing is gone, self destruct in 0 seconds...");
Destroy(this);
return;
}
@ -95,7 +95,7 @@ namespace RoboidControl.Unity {
core.nameChanged = false;
}
if (core.hierarchyChanged) {
// Debug.Log("Parent changed");
Debug.Log("Parent changed");
if (core.parent == null)
this.transform.SetParent(null, true);
else

View File

@ -16,8 +16,6 @@ namespace RoboidControl.Unity {
get => (RoboidControl.TouchSensor)base.core;
}
SphereCollider collider = null;
/// <summary>
/// Start the Unity represention
/// </summary>
@ -26,7 +24,6 @@ namespace RoboidControl.Unity {
participant = FindAnyObjectByType<SiteServer>();
SetCoreThing(new RoboidControl.TouchSensor(participant.site));
}
collider = GetComponent<SphereCollider>();
}
/// <summary>
@ -56,26 +53,11 @@ namespace RoboidControl.Unity {
return component;
}
protected override void Update() {
base.Update();
if (collider.radius == 0.01f &&
this.transform.parent != null && this.transform.localPosition.magnitude > 0
) {
collider.radius = Vector3.Distance(this.transform.position, this.transform.parent.position) / 2;
this.transform.position = (this.transform.position + this.transform.parent.position) / 2;
}
}
private void OnTriggerEnter(Collider other) {
Debug.Log("Touch?");
if (other.isTrigger) {
Debug.Log($" was trigger {other.name}");
if (other.isTrigger)
return;
}
if (this.transform.root == other.transform.root) {
Debug.Log($" was myself {other.name}");
if (this.transform.root == other.transform.root)
return;
}
Debug.Log($"*** {this} Touch");
this.coreSensor.touchedSomething = true;

View File

@ -46,9 +46,7 @@ namespace RoboidControl {
if (this.isIsolated == false) {
// Send to all other participants
//foreach (Participant participant in Participant.participants) {
for (int participantIx = 0; participantIx < Participant.participants.Count; participantIx++) {
Participant participant = Participant.participants[participantIx];
foreach (Participant participant in Participant.participants) {
if (participant == null || participant == this)
continue;
@ -87,7 +85,7 @@ namespace RoboidControl {
Console.WriteLine($"Could not find parent [{msg.networkId}/{msg.parentId}]");
}
else {
// Console.Write($"Dropped {thing.id}");
Console.Write($"Dropped {thing.id}");
thing.parent = null;
}
}

View File

@ -90,7 +90,7 @@ namespace RoboidControl {
this.id = thingId;
this.type = thingType;
this.networkId = networkId;
// Console.Write($"New thing added to {owner}");
Console.Write($"New thing added to {owner}");
this.owner.Add(this);
InvokeNewThing(this);
}

View File

@ -37,9 +37,9 @@ namespace RoboidControl {
get { return _touchedSomething; }
set {
if (_touchedSomething != value) {
touchUpdated = true;
_touchedSomething = value;
}
touchUpdated = true;
}
}
private bool touchUpdated = false;