public void Move() { if (path.Count > 0 || moved == true) { Tile t = path.Peek(); Vector3 target = t.transform.position; //Calculate the unit's position on top of the target tile target.y += halfHeight + t.GetComponent <Collider>().bounds.extents.y; if (Vector3.Distance(transform.position, target) >= 0.05f) { bool jump = transform.position.y != target.y; if (jump) { Jump(target); } else { CalculateHeading(target); SetHorizotalVelocity(); } //Locomotion transform.forward = heading; transform.position += velocity * Time.deltaTime; } else { //Tile center reached transform.position = target; path.Pop(); } } else { RemoveSelectableTiles(); //PONER DE MOMENTO AQUI moving = false; moved = true; turn = false; TurnManagerBeta.EndUnitMoveTurn(); } }
/*public void changePanelcolor (){ * Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); * RaycastHit hit; * if (Physics.Raycast (ray, out hit)) { * if (hit.collider.tag == "NPC") { * TacticsCombat currentAtk = hit.collider.GetComponent <TacticsCombat> (); * Image img = currentAtk.panel.GetComponent<Image> (); * img.color = Color.yellow; * * //Debug.Log ("Jugador " + currentUnit + "clicado"); * } //else { * //Image img = panel.GetComponent<Image> (); * //img.color = Color.red; * //} * } * }*/ public void Atack(float damage, GameObject target) { //HACER ANIMACION DE ATAQUE (SIMPLE) //Vector3 health = panel.transform.localScale; currentlive -= damage; //Debug.Log(currentlive); //health = new Vector3(currentlive, 1f, 1f); if (currentlive > 0) { //HACER CON ANIMACION VER TUTO DE YOUTUBE panel.transform.localScale = new Vector3(currentlive, 1f); } else { Debug.Log("prueba destroy"); Destroy(target, 1f); panel.transform.localScale = new Vector3(0, 1f); } //TurnManagerBeta.currentUnit = null; TurnManagerBeta.currentUnit.turn = false; //PRUEBA TurnManagerBeta.currentAtk.atacked = true; TurnManagerBeta.EndUnitAtkTurn(); }