Esempio n. 1
0
    private void oldOnGUI()
    {
        if (EditorApplication.isPaused)
        {
            StartCoroutine(TrainNetwork());

            print("pause");
            int           bestcheckpoint = -1;
            IANeuralInput bestcart       = null;
            for (int i = 0; i < karts; i++)
            {
                if (bestcheckpoint < iaKarts[i].checkpoint)
                {
                    bestcheckpoint = iaKarts[i].checkpoint;
                    bestcart       = iaKarts[i];
                }
            }
            if (bestcheckpoint > 0)
            {
                print("salvando melhor");


                var cubeRenderer = bestcart.gameObject.GetComponentInChildren <Renderer>();
                cubeRenderer.material.SetColor("_Color", Color.red);
                //bestiaturnDNA = bestcart.GetDNA();
                //PlayerPrefsX.SetFloatArray("BestIA", bestiaturnDNA);
            }
        }
    }
Esempio n. 2
0
    void ResetSim()
    {
        int           bestcheckpoint = -1;
        IANeuralInput bestcart       = null;

        currentRun++;
        for (int i = 0; i < karts; i++)
        {
            if (bestcheckpoint < iaKarts[i].checkpoint)
            {
                bestcheckpoint = iaKarts[i].checkpoint;
                bestcart       = iaKarts[i];
            }
        }
        if (bestcheckpoint > 0)
        {
            iaKarts[0].Reset();
        }
    }