Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        int alive = _genetics.Alive();

        if (alive == 0 || _startTime + 45.0 < Time.time)
        {
            Evolve();
        }
        float score = _genetics.Score * 10;

        if (score > _bestCurrentScore)
        {
            _bestCurrentScore = _genetics.Score;
        }
        if (_bestCurrentScore > _bestAllTimeScore)
        {
            _bestAllTimeScore = _bestCurrentScore;
        }

        string text = "";

        text += "Generation: " + _genetics.Generation + "\n";
        text += "Score: " + (int)_bestCurrentScore + "\n";
        text += "Best score: " + (int)_bestAllTimeScore + "\n";
        text += "Alive: " + alive + "\n";

        Dashboard.text = text;
    }