diff --git a/Cluster.cs b/Cluster.cs index 255dc66..7c77590 100644 --- a/Cluster.cs +++ b/Cluster.cs @@ -193,8 +193,22 @@ public class Cluster : INucleus { // This does not work because the prefab nucleus does not have a state this.prefab.inputs[0].UpdateState(sum); + //this._outputValue = this.output.outputValue; + UpdateResult(this.output.outputValue); } + public virtual void UpdateResult(Vector3 result) { + // float d = Vector3.Distance(result, this.outputValue); + // if (d < 0.5f) { + // //Debug.Log($"insignificant update: {d}"); + // return; + // } + + this.outputValue = result; + foreach (INucleus receiver in this.receivers) + receiver.UpdateState(); + } + public void UpdateNuclei() { this.stale++; if (this.stale > 2) diff --git a/ClusterPrefab.cs b/ClusterPrefab.cs index 151cba5..5786820 100644 --- a/ClusterPrefab.cs +++ b/ClusterPrefab.cs @@ -25,8 +25,11 @@ public class ClusterPrefab : ScriptableObject { if (this._inputs == null) { this._inputs = new(); foreach (IReceptor receptor in this.nuclei) { - if (receptor is INucleus nucleus) - this._inputs.Add(nucleus); + if (receptor is INucleus nucleus) { + // inputs have no incoming synapses yet. + if (nucleus.synapses.Count == 0) + this._inputs.Add(nucleus); + } } } return this._inputs;