Works with major scrums with many ants

This commit is contained in:
Pascal Serrarens 2026-02-12 17:24:10 +01:00
parent 19398ade98
commit 9b948fdd07
2 changed files with 11 additions and 9 deletions

View File

@ -413,9 +413,10 @@ public class ClusterInspector : Editor {
Handles.DrawLine(parentPos, pos); Handles.DrawLine(parentPos, pos);
if (synapse.nucleus != null) { if (synapse.nucleus != null) {
Color color = Color.black; Color color = Color.black;
if (synapse.nucleus.isSleeping) // if (synapse.nucleus.isSleeping)
color = Color.darkRed; // color = Color.darkRed;
else if (Application.isPlaying) { // else
if (Application.isPlaying) {
float brightness = length(synapse.nucleus.outputValue) * synapse.weight / maxValue; float brightness = length(synapse.nucleus.outputValue) * synapse.weight / maxValue;
color = new Color(brightness, brightness, brightness, 1f); color = new Color(brightness, brightness, brightness, 1f);
} }
@ -427,9 +428,10 @@ public class ClusterInspector : Editor {
private void DrawNucleus(Nucleus nucleus, Vector3 position, float maxValue, float size) { private void DrawNucleus(Nucleus nucleus, Vector3 position, float maxValue, float size) {
Color color; Color color;
if (nucleus.isSleeping) // if (nucleus.isSleeping)
color = Color.darkRed; // color = Color.darkRed;
else { // else
{
if (Application.isPlaying) { if (Application.isPlaying) {
float brightness = length(nucleus.outputValue) / maxValue; float brightness = length(nucleus.outputValue) / maxValue;
color = new Color(brightness, brightness, brightness, 1f); color = new Color(brightness, brightness, brightness, 1f);

View File

@ -144,7 +144,7 @@ public class Receptor : Nucleus {
public void ProcessStimulus(Vector3 inputValue, int thingId = 0, string thingName = null) { public void ProcessStimulus(Vector3 inputValue, int thingId = 0, string thingName = null) {
CleanupReceivers(); CleanupReceivers();
if (!thingReceivers.TryGetValue(thingId, out Nucleus selectedReceiver)) { if (!thingReceivers.TryGetValue(thingId, out Nucleus selectedReceiver)) {
Debug.Log($" no receiver found for {thingId}"); //Debug.Log($" no receiver found for {thingId}");
// No existing nucleus for this thing // No existing nucleus for this thing
selectedReceiver = SelectReceptor(thingId, inputValue); selectedReceiver = SelectReceptor(thingId, inputValue);
} }
@ -179,7 +179,7 @@ public class Receptor : Nucleus {
foreach (int thingId in receiversToRemove) { foreach (int thingId in receiversToRemove) {
Nucleus selectedReceiver = thingReceivers[thingId]; Nucleus selectedReceiver = thingReceivers[thingId];
Debug.Log($" removed receiver for {thingId}"); // Debug.Log($" removed receiver for {thingId}");
thingReceivers.Remove(thingId); thingReceivers.Remove(thingId);
int colonPos = selectedReceiver.name.IndexOf(":"); int colonPos = selectedReceiver.name.IndexOf(":");
@ -197,7 +197,7 @@ public class Receptor : Nucleus {
foreach (Nucleus receiver in this._instances) { foreach (Nucleus receiver in this._instances) {
if (thingReceivers.ContainsValue(receiver) == false) { if (thingReceivers.ContainsValue(receiver) == false) {
// We found an unusued receiver // We found an unusued receiver
Debug.Log($"{thingId} -> [{receiver.name}]"); // Debug.Log($"{thingId} -> [{receiver.name}]");
thingReceivers.Add(thingId, receiver); thingReceivers.Add(thingId, receiver);
return receiver; return receiver;
} }