Esempio n. 1
0
    private void SpawnCreature(string chromosome)
    {
        if (this.creature == null)
        {
            return;
        }

        if (currentBest != null)
        {
            Destroy(currentBest.gameObject);
        }

        var creature = evolution.CreateCreature();

        evolution.ApplyBrain(creature, chromosome);

        BCCamera.toFollow = creature;
        currentBest       = creature;

        creature.SetOnBestCreatureLayer();

        // THIS IS NEEDED! DO NOT REMOVE! IMPORTANT!
        creature.Alive = false;
        creature.gameObject.SetActive(false);

        creature.Alive = true;
        creature.gameObject.SetActive(true);
    }