//-----------------------------------------------------------------Funciones behavioural del script---------------------------------------------------------------------------- void Start() { tutScript = this.gameObject.GetComponent <TutorialScript>(); initControl(); initAudio(); Screen.showCursor = false; //Generacion del tablero GameObject tablero = GameObject.FindGameObjectWithTag("tablero"); posInicial = tablero.transform.position; for (int i = 0; i < alto; i++) { for (int j = 0; j < ancho; j++) { GameObject casillaTemp; casillaTemp = Instantiate(prefabCasilla, posInicial + Vector3.right * j + Vector3.forward * i, prefabCasilla.transform.rotation) as GameObject; casillaTemp.name = "Casilla_" + i + "_" + j; casillaTemp.transform.parent = tablero.transform; colorBool colTemp = colorAleatorio(probColor); casillaTemp.GetComponent <scriptCasilla>().color = colTemp; Material matTemp = colBoolToMat(colTemp); casillaTemp.renderer.material = matTemp; controlCasilla controlTemp = matToControl(matTemp); controlTemp.agregar(casillaTemp); casillaTemp.GetComponent <scriptCasilla>().control = controlTemp; } } }
public void cambiaColorJug(colorBool col, GameObject cas, controlCasilla cont, int numCas) { Material matTemp = colBoolToMat(col); controlCasilla controlTemp = matToControl(matTemp); cont.quitar(numCas); controlTemp.agregar(cas); cas.renderer.material = matTemp; scriptCasilla casilla = cas.GetComponent <scriptCasilla>(); casilla.control = controlTemp; }