improved pheromone steering

This commit is contained in:
Pascal Serrarens 2026-02-11 15:05:11 +01:00
parent f40d1ea4ae
commit 2af597fbdb

View File

@ -572,13 +572,18 @@ public class ClusterInspector : Editor {
if (showSynapses) {
anythingChanged = ConnectNucleus(this.prefab, this.currentNucleus);
AddSynapse(this.prefab, this.currentNucleus);
anythingChanged = AddSynapse(this.prefab, this.currentNucleus);
EditorGUILayout.Space();
if (this.currentNucleus is Neuron neuron2)
neuron2.combinator = (Neuron.CombinatorType)EditorGUILayout.EnumPopup("Combinator", neuron2.combinator);
if (this.currentNucleus is Neuron neuron2) {
Neuron.CombinatorType newCombinator = (Neuron.CombinatorType)EditorGUILayout.EnumPopup("Combinator", neuron2.combinator);
anythingChanged |= newCombinator != neuron2.combinator;
neuron2.combinator = newCombinator;
}
this.currentNucleus.bias = EditorGUILayout.Vector3Field("Bias", this.currentNucleus.bias);
Vector3 newBias = EditorGUILayout.Vector3Field("Bias", this.currentNucleus.bias);
anythingChanged |= newBias != this.currentNucleus.bias;
this.currentNucleus.bias = newBias;
NucleusArray array = null;
if (this.currentNucleus.synapses.Count > 0) {
@ -682,10 +687,11 @@ public class ClusterInspector : Editor {
void OnSceneGUI(SceneView sceneView) {
if (this.gameObject != null) {
Vector3 worldVector = this.gameObject.transform.TransformVector(this.currentNucleus.outputValue);
// worldVector = worldVector.normalized;
Handles.color = Color.yellow;
Handles.DrawLine(this.gameObject.transform.position, this.gameObject.transform.position + worldVector);
foreach (Nucleus nucleus in this.currentNucleus.array.nuclei) {
Vector3 worldVector = this.gameObject.transform.TransformVector(nucleus.outputValue);
Handles.color = Color.yellow;
Handles.DrawLine(this.gameObject.transform.position, this.gameObject.transform.position + worldVector);
}
}
}
@ -824,17 +830,16 @@ public class ClusterInspector : Editor {
return true;
}
protected virtual void AddSynapse(ClusterPrefab cluster, Nucleus nucleus) {
protected virtual bool AddSynapse(ClusterPrefab cluster, Nucleus nucleus) {
if (cluster == null)
return;
return false;
//string[] options = { "Neuron", "MemoryCell", "Selector", "Cluster" };
//int selectedInputType = -1;
//selectedInputType = EditorGUILayout.Popup("Add", selectedInputType, options);
//if (selectedInputType >= 0)
Nucleus.Type selectedType = (Nucleus.Type)EditorGUILayout.EnumPopup("Add", Nucleus.Type.None);
if (selectedType != Nucleus.Type.None)
AddInput(selectedType, this.currentNucleus);
if (selectedType == Nucleus.Type.None)
return false;
AddInput(selectedType, this.currentNucleus);
return true;
}
protected virtual void DisconnectNucleus(Neuron nucleus) {