First gaze version
This commit is contained in:
parent
15b298f399
commit
116a5819e0
22
Neuron.cs
22
Neuron.cs
@ -278,19 +278,19 @@ public class Neuron : Nucleus {
|
||||
set { _receivers = value; }
|
||||
}
|
||||
|
||||
public virtual void AddReceiver(Nucleus receiverToAdd, float weight = 1) {
|
||||
if (this is IReceptor receptor) {
|
||||
foreach (Nucleus element in receptor.array.nuclei) {
|
||||
if (element is Neuron neuron) {
|
||||
neuron._receivers.Add(receiverToAdd);
|
||||
receiverToAdd.AddSynapse(element, weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
public virtual void AddReceiver(Nucleus receiverToAdd, float weight = 1) {
|
||||
// if (this is IReceptor receptor) {
|
||||
// foreach (Nucleus element in receptor.array.nuclei) {
|
||||
// if (element is Neuron neuron) {
|
||||
// neuron._receivers.Add(receiverToAdd);
|
||||
// receiverToAdd.AddSynapse(element, weight);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
this._receivers.Add(receiverToAdd);
|
||||
receiverToAdd.AddSynapse(this, weight);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public virtual void RemoveReceiver(Nucleus receiverToRemove) {
|
||||
|
||||
16
Receptor.cs
16
Receptor.cs
@ -18,7 +18,9 @@ public class Receptor : Neuron, IReceptor {
|
||||
}
|
||||
|
||||
public override Nucleus ShallowCloneTo(Cluster parent) {
|
||||
Receptor clone = new(parent, name);
|
||||
Receptor clone = new(parent, name) {
|
||||
|
||||
};
|
||||
CloneFields(clone);
|
||||
return clone;
|
||||
}
|
||||
@ -27,6 +29,10 @@ public class Receptor : Neuron, IReceptor {
|
||||
array = this.array
|
||||
};
|
||||
CloneFields(clone);
|
||||
// Adding receivers will also add synapses to the receivers
|
||||
foreach (Nucleus receiver in this.receivers.ToArray())
|
||||
clone.AddReceiver(receiver);
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
@ -37,6 +43,14 @@ public class Receptor : Neuron, IReceptor {
|
||||
set { _array = value; }
|
||||
}
|
||||
|
||||
public virtual void AddArrayReceiver(Nucleus receiverToAdd, float weight = 1) {
|
||||
foreach (Nucleus element in this.array.nuclei) {
|
||||
if (element is Neuron neuron) {
|
||||
neuron.AddReceiver(receiverToAdd, weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateStateIsolated() {
|
||||
this.outputValue = this.bias;
|
||||
//Debug.Log($"Receptor {this.name} outputvalue = {this.outputValue}");
|
||||
|
||||
106
Selector.asset
106
Selector.asset
@ -1,106 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 60a957541c24c57e78018c202ebb1d9b, type: 3}
|
||||
m_Name: Selector
|
||||
m_EditorClassIdentifier: Assembly-CSharp::ClusterPrefab
|
||||
nuclei:
|
||||
- rid: 5479437130421501952
|
||||
- rid: 5479437186280456251
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 5479437130421501952
|
||||
type: {class: Neuron, ns: , asm: Assembly-CSharp}
|
||||
data:
|
||||
_name: Output
|
||||
_synapses:
|
||||
- nucleus:
|
||||
rid: 5479437186280456251
|
||||
weight: 1
|
||||
_receivers: []
|
||||
_array:
|
||||
rid: 5479437130421501953
|
||||
_curvePreset: 0
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 1
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1000
|
||||
value: 1000
|
||||
inSlope: 1
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
curveMax: 1
|
||||
average: 1
|
||||
- rid: 5479437130421501953
|
||||
type: {class: NucleusArray, ns: , asm: Assembly-CSharp}
|
||||
data:
|
||||
_nuclei:
|
||||
- rid: 5479437130421501952
|
||||
name: Output
|
||||
- rid: 5479437186280456251
|
||||
type: {class: Selector, ns: , asm: Assembly-CSharp}
|
||||
data:
|
||||
_name: Selector
|
||||
_synapses: []
|
||||
_receivers:
|
||||
- rid: 5479437130421501952
|
||||
_array:
|
||||
rid: 5479437186280456252
|
||||
_curvePreset: 0
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 1
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1000
|
||||
value: 1000
|
||||
inSlope: 1
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
curveMax: 1
|
||||
average: 0
|
||||
- rid: 5479437186280456252
|
||||
type: {class: NucleusArray, ns: , asm: Assembly-CSharp}
|
||||
data:
|
||||
_nuclei:
|
||||
- rid: 5479437186280456251
|
||||
name: New Selector
|
||||
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5b3a22d9bb7d13aeb3174077125967b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user