/// <summary> /// Función que permite intecambiar el turno de un jugador. /// Primeramente, desactiva el movimiento de todos los totems de los dos jugadores. /// </summary> public void intercambiarTurno() { // Desactivo el movimiento del totem del jugador if (totemActual != null) { this.totemActual.desabilitarControlMovimiento(); } resetContornoTotemActual(); // Intercambio el turno del jugador turnoJugador = turnoJugador == TURNO_JUGADOR.PRIMER_JUGADOR ? TURNO_JUGADOR.SEGUNDO_JUGADOR : TURNO_JUGADOR.PRIMER_JUGADOR; switch (turnoJugador) { case TURNO_JUGADOR.PRIMER_JUGADOR: totemActual = this.listaTotemsJugador.Poll(); totemActual.activarControlMovimiento(); break; case TURNO_JUGADOR.SEGUNDO_JUGADOR: totemActual = this.listaTotemsContrincante.Poll(); totemActual.activarControlMovimiento(); break; } actualizarContornoTotemActual(); StartCoroutine(intercambiarInventario()); if (!BoxTurn()) { ThrowBox(); } SwitchBoxTurn(); }
private void handleInicioRonda() { // Primeramente desactivo el movimiento de todos los totems this.desactivarMovimientoTotems(); resetContornoTotemActual(); // Por defecto, a cada inicio de ronda empezará el primer jugador con el movimiento activado this.totemActual = this.listaTotemsJugador.Poll(); this.totemActual.activarControlMovimiento(); // Finalmente, actualizo el estado this.estadoPartida = PARTIDA_STATE.TURNO_RONDA; this.turnoJugador = TURNO_JUGADOR.PRIMER_JUGADOR; ronda += 1; txtNumeroRonda.text = "ROUND: " + ronda; StartCoroutine(intercambiarInventario()); // Actualiza el contorno del módulo actualizarContornoTotemActual(); if (BoxTurn()) { ThrowBox(); } }
// Use this for initialization void Start() { this.stateHolder = GetComponent <StateHolder>(); initPlayers(); estadoPartida = PARTIDA_STATE.INICIO_RONDA; turnoJugador = TURNO_JUGADOR.PRIMER_JUGADOR; GameObject inventarioGameObject = GameObject.FindGameObjectWithTag("MainInventory"); this.inventario = inventarioGameObject.GetComponent <Inventory>(); GameObject hotbarGameObject = GameObject.FindGameObjectWithTag("Hotbar"); this.hotbar = hotbarGameObject.GetComponent <Inventory>(); gestorInventario = this.gameObject.AddComponent <GestionInventario>(); gestorInventario.inventory = inventarioGameObject; gestorHotbar = this.gameObject.AddComponent <GestionHotbar>(); gestorHotbar.inventory = hotbarGameObject; condicionFinJuego = GetComponent <EndGameCondition>(); gameObject.AddComponent <PlatformSpawner> (); //txtTurnoJugador.text = "Turno: " + turnoJugador.ToString(); ronda = 0; turnCounter = 1; numCajasLanzadas = 1; this.listaItemsPrimerJugador = new List <int>(); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoAngel); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoEscudoDoble); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoEscudoSimple); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoIglu); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoBomb); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoGrenade); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoSemtex); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoMissile); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoBomb); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoGrenade); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoSemtex); listaItemsPrimerJugador.Add(Global.TIPO_OBJETOS.objetoMissile); this.listaItemsSegundoJugador = new List <int>(); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoAngel); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoEscudoDoble); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoEscudoSimple); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoIglu); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoBomb); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoGrenade); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoSemtex); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoMissile); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoBomb); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoGrenade); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoSemtex); listaItemsSegundoJugador.Add(Global.TIPO_OBJETOS.objetoMissile); }