private void Awake() { if (newNetowrk || brain == null) { int inputSize = gridSize.x * gridSize.y; NEATNetowrk = new NEAT(inputSize, outputs); } else { SaveBrain saveBrain = brain.GetNEAT(); NEATNetowrk = saveBrain.LoadBrain(); gridSize = new Vector2Int((int)saveBrain.gridSize[0], (int)saveBrain.gridSize[1]); bucketSize = new Vector2Int((int)saveBrain.bucketSize[0], (int)saveBrain.bucketSize[1]); offset = new Vector2Int((int)saveBrain.offset[0], (int)saveBrain.offset[1]); NEATNetowrk.DenugNEAT(); } ///convert all layers to a singel one string[] layerNames = new string[MasksToCheck.Length]; for (int i = 0; i < layerNames.Length; i++) { int counter = 0; int currentLayer = MasksToCheck[i]; while (currentLayer > 0) { counter++; currentLayer = currentLayer >> 1; } layerNames[i] = LayerMask.LayerToName(counter - 1); } combinedMask = LayerMask.GetMask(layerNames); maskTable = new Dictionary <LayerMask, int>(); for (int i = 0; i < MasksToCheck.Length; i++) { maskTable.Add(MasksToCheck[i], i); } }
public void DebugNEAT() { NEATNetowrk.DenugNEAT(); }