//public static bool npcTurn = false; //static Queue<TacticsMove> turnKey = new Queue<TacticsMove>(); // TURNO PARA CADA EQUIPO void Start() { currentUnit = null; currentEnemy = null; enemyHealthBar = null; currentAtk = null; endGameText = gameObject.GetComponent <TextMeshProUGUI>(); countMovText.text = "Movimientos restantes : " + countMovs.ToString(); countAtkText.text = "Movimientos restantes : " + countAtks.ToString(); }
public static void InitPlayerTurn() { Debug.Log("TurnoJugador"); GameObject[] units = GameObject.FindGameObjectsWithTag("Player"); Debug.Log(units.Length); countMovs = units.Length; countAtks = units.Length; foreach (GameObject unit in units) { TacticsMove player = unit.GetComponent <TacticsMove>(); TacticsCombat combat = unit.GetComponent <TacticsCombat>(); combat.atacked = false; player.moved = false; player.turn = false; player.moveRange = 4; //CAMBIAR POR EL VALOR QUE TOQUE A CADA "HEROE" } //HACER EL CAMBIO DE NPC A PLAYER }
public void SelectUnit() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; panel.SetActive(false); //Image img1 = currentAtk.panel.GetComponent<Image> (); //img1.color = Color.green; if (Physics.Raycast(ray, out hit)) { if (hit.collider.tag == "Player") { //Debug.Log ("Jugador " + currentUnit + "clicado"); if (currentUnit != null) { currentUnit.turn = false; //PARA LIMPIAR LA ACTUAL AL CLICAR OTRA Image img1 = currentAtk.panel.GetComponent <Image> (); img1.color = Color.green; } currentUnit = hit.collider.GetComponent <TacticsMove> (); currentAtk = hit.collider.GetComponent <TacticsCombat> (); //PRUEBAS Image img = currentAtk.panel.GetComponent <Image> (); img.color = Color.blue; if (currentUnit.moved == true) { currentUnit.moveRange = 0; Debug.Log("Esta unidad ya se ha movido."); } //else { panel.SetActive(true); // panel de skills InitUnitTurn(); //} } /* else if (hit.collider.tag == "Player"){ //SI CLICAS ALGO QUE NO SEA LA FICHA -> CREO QUE SOBRA * //currentUnit = null; * } else { * currentUnit = null; * }*/ } } }
//PRUEBAS PARA ATACAR FALTAN MUCHAS COMPROVACIONES COMO VER SI A ATACADO public void SelectEnemy() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.collider.tag == "NPC") { //Debug.Log ("Rival clicado"); currentEnemy = hit.collider.GetComponent <TacticsMove> (); enemyHealthBar = hit.collider.GetComponent <TacticsCombat> (); //Debug.Log (currentEnemy + " prueba de Log."); if (currentUnit.turn != false) { //Debug.Log ("Iniciar proceso de ataque"); //PRUEBA SOLO VALIDA PARA RANGO DE ATAQUE 1. // !!! CAMBIAR ADJENCYLIST POR UNA LISTA cON LAS CASILLAS EN RANGO. POR ESO NO FUNCIONA(X) - REVISAR playerOnRangeList(V); List <Tile> adjacencyList = currentUnit.currentTile.playerOnRangeList; foreach (Tile tile in adjacencyList) { //Debug.Log ("entra a las casillas"); if (tile.enemyHere == true) { //Debug.Log ("Enemigo fijado iniciar ataque."); //TacticsCombat currentAtk = hit.collider.GetComponent <TacticsCombat> (); //PRUEBAS ATQUE if (currentAtk.atacked == false) { //currentAtk.Atack (); enemyHealthBar.Atack(0.4f, hit.collider.gameObject); } else { Debug.Log("Esta unidad ya ha atacado."); } } } //VER COMO COMPROBAR SI ESTA EN RANGO DE ATAQUE //SI ESTA EN RANGO DE ATAQUE //ATACAR // ELSE (NO EN RANGO) //SI SE HA MOVIDO /*if (currentUnit.moved == true) { * Debug.Log ("No puedes hacer nada más"); * } else { * //MOVER A CASILLA MAS CERCANA Y VOLVER A COMPRAROVAR SI ESTA EN RANGO DE ATAQUE * }*/ //} } else { Debug.Log("No hay currentUnit"); } /*} else { //SI CLICAS ALGO QUE NO SEA LA FICHA * Debug.Log("Agua"); * currentEnemy = null; * }*/ } } } }