ec3b1d4 Completed cluster documentation 348fee3 Update .gitea/workflows/copy_documentation.yml 911e52f Update .gitea/workflows/copy_documentation.yml d472790 Update .gitea/workflows/copy_documentation.yml b87f40f Trying to get the workflow running...10 2b0db4f Trying to get the workflow running...9 927fd6d Trying to get the workflow running...8 176f399 Trying to get the workflow running...7 3c841c7 Trying to get the workflow running...6 5c798c2 Trying to get the workflow running...5 30b25a1 Trying to get the workflow running...4 5edf019 Trying to get the workflow running...3 587cf82 Trying to get the workflow running...2 a1d3aa7 Trying to get the workflow running...1 97ec277 Removed LinearAlgebra, first setup webserver copy workflow 5827396 Fixed documentation links ce19335 Added Documentation da370bb Improvements 32b5885 Multi smell works 33ea14b Single smell works a651ec6 Add neuron property drawer baa7def Pheromones WIP 551b4d9 Improve ant walking speed 7187f61 Ant is walking again c78722a Make it work again 2ff550c Removed clusterPrefab property 2ef67fe Cleanup and fix connect neuron a9a0072 Merge commit 'dd326823a8256f3ddb808e071d98c4aede72e410' 22ee17c Insect rig improvements b6a3bc1 Added insect body parts 517e738 Merge commit '4ae9a15fc61f386b96ce0f7b440780f562d7dc68' 033ddf4 Merge commit '05fd588f9bc41d84113d410a2ca992f1a2ee66e0' ef700c0 Merge commit '3f8716794ad9d685cfb9ed9dd230eb31cd8df10f' 7d5e157 Added NanoBrain namespace f138201 Merge commit '611055cdcd58b01f2f19991ad35eb8fe8e573ebb' 1c4d361 Merge commit '9fcbaa5bf84f91680d24b56dbf114bcb97de4aee' 0f83945 Added NanoBrain subtree 6f398ad Merge commit '8e87e4ea77308b51c3691bdad96e7f9707952821' as 'NanoBrain' 587f104 Move out non-subtree NanoBrain fc581a0 cleanup & documentation 837c5ce WIP Physics based walking 63486d1 The ant does it ant things! ce8e476 Added sample assets... 88d5eb5 Placing home pheromones 481829c Ensure model follows target in editor 018c99d Any walks e709ea4 Steps to get it working c1dcc83 Initial Ant setup af2fa77 Merge commit '04ca8dda0793476a59fc06f1958453730a99c105' as 'NanoBrain' 04ca8dd Squashed 'NanoBrain/' content from commit b3423b9 d9ba98d WIP: Initial scripts 2219e98 Initial commit git-subtree-dir: NanoBrain git-subtree-split: ec3b1d46ab2b9f332a8ae63589b09c3fb6fb1b1a
149 lines
4.5 KiB
C#
149 lines
4.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// The Nanobrain namespace
|
|
/// </summary>
|
|
namespace NanoBrain {
|
|
|
|
/// <summary>
|
|
/// A Nucleus is a basic element in a brain cluster
|
|
/// </summary>
|
|
[Serializable]
|
|
public abstract class Nucleus {
|
|
/// <summary>
|
|
/// The name of the Nucleus
|
|
/// </summary>
|
|
public string name;
|
|
|
|
// [NonSerialized]
|
|
// public Nucleus prefabNucleus;
|
|
|
|
/// <summary>
|
|
/// The cluster prefab in which the nucleus is located
|
|
/// </summary>
|
|
// [SerializeReference]
|
|
// public ClusterPrefab clusterPrefab;
|
|
|
|
/// <summary>
|
|
/// The cluster instance in which the nucleus is located
|
|
/// </summary>
|
|
[SerializeReference]
|
|
public Cluster parent;
|
|
|
|
/// <summary>
|
|
/// Toggle for printing debugging trace data
|
|
/// </summary>
|
|
//public bool trace = false;
|
|
|
|
/// <summary>
|
|
/// Function to make a partial clone of this nucleus
|
|
/// </summary>
|
|
/// <param name="parent">The cluster in which the cloned nucleus should be placed</param>
|
|
/// <returns></returns>
|
|
public abstract Nucleus ShallowCloneTo(Cluster parent);
|
|
/// <summary>
|
|
/// Function to clone a nucleus to a Cluster prefab
|
|
/// </summary>
|
|
/// <param name="prefab"></param>
|
|
/// <returns></returns>
|
|
// public abstract Nucleus Clone(ClusterPrefab prefab);
|
|
|
|
/// <summary>
|
|
/// The types of Nucleus
|
|
/// </summary>
|
|
public enum Type {
|
|
None,
|
|
Neuron,
|
|
MemoryCell,
|
|
Cluster,
|
|
//Receptor,
|
|
//ClusterReceptor,
|
|
//ClusterArray,
|
|
}
|
|
|
|
// public virtual void Initialize() {}
|
|
|
|
// #region Synapses
|
|
|
|
// /// <summary>
|
|
// /// The bias of the nucleus
|
|
// /// </summary>
|
|
// /// The bias which a value which is always added to the combined value of the nucleus
|
|
// /// It does not have a synapse and therefore no weight of source nucleus
|
|
// //public Vector3 bias = Vector3.zero;
|
|
|
|
// [SerializeField]
|
|
// private List<Synapse> _synapses = new();
|
|
// /// <summary>
|
|
// /// The synapses of the nucleus
|
|
// /// </summary>
|
|
// public List<Synapse> synapses => _synapses;
|
|
|
|
// /// <summary>
|
|
// /// Add a new synapse to this nuclues
|
|
// /// </summary>
|
|
// /// <param name="sendingNucleus">The nucleus from which the signals may originate</param>
|
|
// /// <param name="weight">The weight applied to the input. Default value = 1</param>
|
|
// /// <returns>The created Synapse</returns>
|
|
// /// This will add a new input to this nucleus with the given weight.
|
|
// public Synapse AddSynapse(Neuron sendingNucleus, float weight = 1) {
|
|
// Synapse synapse = new(sendingNucleus, weight);
|
|
// this.synapses.Add(synapse);
|
|
// return synapse;
|
|
// }
|
|
|
|
// // public Synapse AddSynapse(ClusterPrefab clusterPrefab, string neuronName, float weight = 1) {
|
|
|
|
// // }
|
|
|
|
// /// <summary>
|
|
// /// Find a synapse
|
|
// /// </summary>
|
|
// /// <param name="sender">The sender of the input to the Synapse</param>
|
|
// /// <returns>The found Synapse or null when the sender has no synapse to this nucleus.</returns>
|
|
// public Synapse GetSynapse(Nucleus sender) {
|
|
// foreach (Synapse synapse in this.synapses)
|
|
// if (synapse.neuron == sender)
|
|
// return synapse;
|
|
// return null;
|
|
// }
|
|
|
|
// /// <summary>
|
|
// /// Remove a synapse from a Nucleus
|
|
// /// </summary>
|
|
// /// <param name="sendingNucleus">Remote the synapse connecting to this Nucleus</param>
|
|
// public void RemoveSynapse(Nucleus sendingNucleus) {
|
|
// this.synapses.RemoveAll(synapse => synapse.neuron == sendingNucleus);
|
|
// }
|
|
|
|
// #endregion Synapses
|
|
|
|
#region Update
|
|
|
|
/// <summary>
|
|
/// Update the state without updating other Nuclei
|
|
/// </summary>
|
|
public abstract void UpdateStateIsolated();
|
|
|
|
/// <summary>
|
|
/// Update the state and recursively all Nuclei receiving data from this Nucleus
|
|
/// </summary>
|
|
public virtual void UpdateNuclei() {
|
|
}
|
|
|
|
// /// <summary>
|
|
// /// Set the bias, recalculate the output and update all Nuclei receiving from this Nucleus
|
|
// /// </summary>
|
|
// /// <param name="inputValue"></param>
|
|
// public virtual void SetBias(Vector3 inputValue) {
|
|
// this.bias = inputValue;
|
|
// this.parent.UpdateFromNucleus(this);
|
|
// }
|
|
|
|
#endregion Update
|
|
|
|
}
|
|
|
|
} |