コード例 #1
0
 private void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         NodesConnectionUIListener.DeactivateLastShowedInfo();
     }
     ShowGenome();
     UpdateGenomeData();
 }
コード例 #2
0
    /// <summary>
    /// Reset the genomeDataPanel view. Disable the Nodes and NodesConnections UI elements and add them to the pool.
    /// </summary>
    public void ClearGenomePanel(bool unlockLastBrain)
    {
        // Deactivate NodesConnection weight, reset the panel colors and lastBrain data:
        NodesConnectionUIListener.DeactivateLastShowedInfo();
        genomeDataText.color       = Color.white;
        genomeDataPanelImage.color = new Color(1, 1, 1, 0.39f);

        lastBrain            = null;
        nodesActivationTexts = null;
        if (unlockLastBrain)
        {
            lastBrainIsLocked        = false;
            genomeDataText.fontStyle = FontStyles.Normal;
            StopDrawBestGenomeFromSpeciesCoroutine();
        }

        // Add Nodes to the pool:
        genomeDataNodesQueue.Clear();
        int childrenNumberInPanel = genomeDataPanelNodes.childCount;

        for (int i = 0; i < childrenNumberInPanel; i++)
        {
            GameObject child = genomeDataPanelNodes.GetChild(i).gameObject;
            child.SetActive(false);
            genomeDataNodesQueue.Enqueue(child);
        }

        // Add NodesConnections to the pool:
        genomeDataNodesConnectionsQueue.Clear();
        childrenNumberInPanel = genomeDataPanelNodesConnections.childCount;

        for (int i = 0; i < childrenNumberInPanel; i++)
        {
            GameObject child = genomeDataPanelNodesConnections.GetChild(i).gameObject;
            child.SetActive(false);
            genomeDataNodesConnectionsQueue.Enqueue(child);
        }
    }