void Awake() { Debug.Log("Guardar datos Aqu�: " + Application.persistentDataPath); year = 0; guardaCelulasMinimasIniciales = cantCelulasMinimas; yearsDeExtincion = new List <int>(); board = GetComponent <BoardManager>(); generaCell = GetComponent <GeneraCell>(); int seedControl = Random.Range(0, 10000); board.SetupScene(10, ref mapa, columnas, filas, bordesAgua); //Random.InitState(seedControl); GameObject[] celula = GameObject.FindGameObjectsWithTag("Cell"); for (int i = 0; i < celula.Length; i++) { celula[i].GetComponent <Cell>().IniciarCiclo(); } RecorreMapaSumando(100); StartCoroutine(GenerarCelulas(cantCelulasMinimas)); StartCoroutine(ComidaMapa()); StartCoroutine(AutoGuardar()); StartCoroutine(Year()); empezo = true; }
private void Start() { datosCell.SetActive(false); gameController = GetComponent <GameController>(); generaCell = GetComponent <GeneraCell>(); Time.timeScale = gameController.ObtenerVelocidad(); }
public IEnumerator GenerarCelulas(int cantidad) { generando = true; GeneraCell genCell = GetComponent <GeneraCell>(); for (int i = 0; i < cantidad; i++) { float posX; float posY; do { posX = Mathf.Round(Random.Range(bordesAgua + 1, columnas - bordesAgua - 1)); posY = Mathf.Round(Random.Range(bordesAgua + 1, filas - bordesAgua - 1)); } while (mapa[(int)posX, (int)posY] < 1); if (generarDeMemoria == "") { genCell.GenerarAleatoria(celulasTotales, new Vector2(posX, posY)); } else { genCell.GenerarDeMemoriaYMutar(generarDeMemoria, celulasTotales, new Vector2(posX, posY)); } celulasTotales++; cantCelulasVivas++; //yield return new WaitForEndOfFrame(); } yearUltimaGeneracion = year; generando = false; yield return(null); }
private void Awake() { cerebro = new Cerebro(); salidaRed = new float[cantSalidas + cantMemoria]; memoria = new float[cantMemoria]; tick.SetActive(false); //redNeuronal = GetComponent<Red>(); funcionActivacion = new FuncionesActivacion(); gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>(); generaCell = gameController.GetComponent <GeneraCell>(); rig = GetComponent <Rigidbody2D>(); spriteRen = GetComponent <SpriteRenderer>(); color = GetComponent <SpriteRenderer>().color; antena1Ren = antena1.GetComponent <SpriteRenderer>(); antena2Ren = antena2.GetComponent <SpriteRenderer>(); antena1Coll = antena1.GetComponent <BoxCollider2D>(); antena2Coll = antena2.GetComponent <BoxCollider2D>(); // la posicion 10 en realidad esta entre 9.5 y 10.5 posTile = new Vector2(Mathf.Round(rig.position.x), Mathf.Round(rig.position.y)); velocidadTiempo = 1; InicializaRed(); IniciarCiclo(); posInicial = new Vector2(posTile.x, posTile.y); SondeoDeLaRed(); ActualizarDiametro(); }