-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated node fireing simplified nodes ordering, and removed the other list
- Loading branch information
Showing
8 changed files
with
457 additions
and
58 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
using NeatFish.Simulation.NEAT; | ||
using System.Collections.Generic; | ||
|
||
public class Inspector : MonoBehaviour { | ||
|
||
public NeuralNet Brain; | ||
|
||
public GameObject panel; | ||
|
||
private Dictionary<uint, Text> NeuronTexts; | ||
|
||
private void Start() | ||
{ | ||
NeuronTexts = new Dictionary<uint, Text>(); | ||
|
||
Font ArialFont = (Font)Resources.GetBuiltinResource(typeof(Font), "Arial.ttf"); | ||
|
||
foreach (Node n in Brain.Neurons) { | ||
var o = new GameObject("N " + n.Id.ToString() + " " + n.type); | ||
|
||
o.transform.localPosition = Vector3.zero; | ||
o.transform.localRotation = Quaternion.identity; | ||
|
||
var t = o.AddComponent<Text>(); | ||
t.rectTransform.localPosition = new Vector3(n.Position.x * 150, 0, n.Position.y * 50); | ||
t.rectTransform.localRotation = Quaternion.identity; | ||
|
||
t.font = ArialFont; | ||
t.material = ArialFont.material; | ||
t.fontSize = 7; | ||
t.alignment = TextAnchor.UpperLeft; | ||
t.text = n.GetValue().ToString(); | ||
|
||
NeuronTexts.Add(n.Id, t); | ||
|
||
o.transform.SetParent(panel.transform); | ||
} | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
foreach (Node n in Brain.Neurons) { | ||
NeuronTexts[n.Id].text = n.GetValue().ToString(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters