ant and mouth share the same brain
This commit is contained in:
parent
2cae7a6c41
commit
7bcd4a6cf1
@ -86,8 +86,12 @@ public class Cluster : Nucleus {
|
||||
int arrayIx = 0;
|
||||
foreach (Nucleus prefabArrayNucleus in prefabNucleus.array.nuclei) {
|
||||
int arrayNucleusIx = GetNucleusIndex(prefabNuclei, prefabArrayNucleus);
|
||||
if (arrayNucleusIx >= 0) {
|
||||
Nucleus clonedArrayNucleus = clonedNuclei[arrayNucleusIx];
|
||||
clonedArray.nuclei[arrayIx] = clonedArrayNucleus;
|
||||
} else {
|
||||
Debug.LogError($" Could not find prefab nuclues {prefabNucleus.name} in the clones");
|
||||
}
|
||||
arrayIx++;
|
||||
}
|
||||
clonedNucleus.array = clonedArray;
|
||||
@ -138,9 +142,9 @@ public class Cluster : Nucleus {
|
||||
return sortedOrder;
|
||||
}
|
||||
|
||||
public override Nucleus Clone() {
|
||||
public override Nucleus Clone(ClusterPrefab prefab) {
|
||||
//Neuron clone = new(this.cluster, this.name) {
|
||||
Neuron clone = new(this.parent, this.name) {
|
||||
Neuron clone = new(prefab, this.name) {
|
||||
array = this.array,
|
||||
};
|
||||
|
||||
|
||||
@ -550,7 +550,7 @@ public class ClusterInspector : Editor {
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.IntField("Array size", neuroid.array.nuclei.Count());
|
||||
if (GUILayout.Button("Add"))
|
||||
neuroid.array.AddNucleus();
|
||||
neuroid.array.AddNucleus(this.cluster);
|
||||
if (GUILayout.Button("Del"))
|
||||
neuroid.array.RemoveNucleus();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
@ -139,8 +139,8 @@ public class Neuron : Nucleus {
|
||||
return clone;
|
||||
}
|
||||
|
||||
public override Nucleus Clone() {
|
||||
Neuron clone = new(this.cluster, this.name) {
|
||||
public override Nucleus Clone(ClusterPrefab prefab) {
|
||||
Neuron clone = new(prefab, this.name) {
|
||||
//Neuron clone = new(this.parent, this.name) {
|
||||
array = this.array,
|
||||
curve = this.curve,
|
||||
|
||||
@ -34,7 +34,7 @@ public abstract class Nucleus {
|
||||
public int stale = 1000;
|
||||
|
||||
public abstract Nucleus ShallowCloneTo(Cluster parent);
|
||||
public abstract Nucleus Clone();
|
||||
public abstract Nucleus Clone(ClusterPrefab prefab);
|
||||
|
||||
#region Synapses
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ public class NucleusArray {
|
||||
}
|
||||
|
||||
|
||||
public void AddNucleus() {
|
||||
public void AddNucleus(ClusterPrefab prefab) {
|
||||
if (this._nuclei.Length == 0) {
|
||||
Debug.LogError("Empty perceptoid array, cannot add");
|
||||
return;
|
||||
@ -39,7 +39,7 @@ public class NucleusArray {
|
||||
for (int i = 0; i < this._nuclei.Length; i++)
|
||||
newArray[i] = this._nuclei[i];
|
||||
if (this._nuclei[0] is Nucleus nucleus)
|
||||
newArray[newLength - 1] = nucleus.Clone();
|
||||
newArray[newLength - 1] = nucleus.Clone(prefab);
|
||||
|
||||
this._nuclei = newArray;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user