Example #1
0
 public static void AtualizarArquivoJogo(Persistente data)
 {
     dadosJogador.iniciouGame    = true;
     dadosJogador.evolutionState = data.evolutionState;
     dadosJogador.cromossomos    = data.cromossomos;
     dadosJogador.highScore      = data.highScore;
     dadosJogador.lastScore      = data.lastScore;
     dadosJogador.lastScores     = data.lastScores;
 }
Example #2
0
    void Awake()
    {
        if (instancia == null)
        { // esto se ejecuta una sola vez en todo el programa.
            instancia = this;
            DontDestroyOnLoad(gameObject);

            CargarDatos();
        }
        else
        {
            Destroy(gameObject);
        }
    }
Example #3
0
    void Start()
    {
        try {
            arquivoGame = SaveControl.LoadArquivoJogo();
        } catch (Exception) {
            arquivoGame = new Persistente();
        }

        if (arquivoGame.iniciouGame)
        {
            cromossomosUsados = arquivoGame.cromossomos;

            this.AjustaArrayScore();
            this.Evolucao();

            for (int i = 0; i < 100; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    caixas[(j + (i * 10))] = (GameObject)Instantiate(caixasPrefab, new Vector2(colunasPossiveis[cromossomosUsados[i].cromossomo[j]], 1.28f * (float)(j + (i * 10))), Quaternion.identity);
                }
            }

            //Iniciar sempre no centro
            Destroy(caixas[0]);
            caixas[0] = (GameObject)Instantiate(caixasPrefab, new Vector2(colunasPossiveis[1], 0), Quaternion.identity);
        }
        else
        {
            this.GerarPopulacaoInicial();

            for (int i = 0; i < 100; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    caixas[(j + (i * 10))] = (GameObject)Instantiate(caixasPrefab, new Vector2(colunasPossiveis[cromossomosUsados[i].cromossomo[j]], 1.28f * (float)(j + (i * 10))), Quaternion.identity);
                }
            }

            //Iniciar sempre no centro
            Destroy(caixas[0]);
            caixas[0] = (GameObject)Instantiate(caixasPrefab, new Vector2(colunasPossiveis[1], 0), Quaternion.identity);
        }

        this.VerificarPontuacao();
    }