public void SetShaderTextures(BrainNetworkVisualizer visualizer) { for(int i = 0; i < critterBeingTested.critterSegmentList.Count; i++) { //critterBeingTested.critterSegmentList[i].GetComponent<MeshRenderer>().material.SetColor("_Color", new Color(0f, 0.5f, 0.1f)); //Debug.Log("Set Color!"); critterBeingTested.critterSegmentList[i].GetComponent<MeshRenderer>().material.SetTexture("_NeuronPosTex", visualizer.neuronPositionsTexture); //Debug.Log("Set Color!" + visualizer.neuronPositionsTexture.width.ToString()); } //critterBeingTested.critterSegmentMaterial.SetTexture("_NeuronPosTex", networkVisualizer.neuronPositionsTexture); }
public void BuildBrainMesh(BrainNEAT brain) { MiniGameManager currentGameManager = PlayerList[playingCurPlayer].masterTrialsList[playingCurTrialIndex].miniGameManager; if (brainNetworkGO == null) { brainNetworkGO = new GameObject("brainNetworkGO"); brainNetworkGO.AddComponent<MeshFilter>(); //Material brainNetworkMat = new Material(Shader.Find("Custom/SimpleBrainNetworkShader")); brainNetworkGO.AddComponent<MeshRenderer>().material = brainNetworkMat; networkVisualizer = brainNetworkGO.AddComponent<BrainNetworkVisualizer>(); if (currentGameManager.miniGameInstance.critterBeingTested != null) { networkVisualizer.sourceCritter = currentGameManager.miniGameInstance.critterBeingTested; } //currentGameManager.miniGameInstance.critterBeingTested.critterSegmentMaterial.SetTexture("_NeuronPosTex", networkVisualizer.neuronPositionsTexture); } MiniGameCritterWalkBasic minigame = (MiniGameCritterWalkBasic)currentGameManager.miniGameInstance as MiniGameCritterWalkBasic; networkVisualizer.InitShaderTexture(brain); minigame.SetShaderTextures(networkVisualizer); brainNetworkGO.GetComponent<MeshFilter>().sharedMesh = networkVisualizer.BuildNewMesh(brain); }