private void InstantiateBall()// instancia una flecha { // posición donde aparecerá la flecha Vector3 positionForArrow = new Vector3(transform.position.x, transform.position.y + initialPosCorrection.y, transform.position.z); Hero currentTarget = BattleController.currentTarget.GetComponentInChildren <Hero>(); Quaternion rotation = CalcRotation.CalculateRotation(currentTarget);; // determina el ángulo de rotación de la flecha DamagingFlyingObject ball = Instantiate(mageBall, positionForArrow, rotation, transform); // crea una instancia de un objeto flecha ball.FireArrow(dealsDamage); //fires the arrow }
private void InstantiateBall()//instantiates an arrow { //position where the arrow will appear Vector3 positionForArrow = new Vector3(transform.position.x, transform.position.y + initialPosCorrection.y, transform.position.z); Hero currentTarget = BattleController.currentTarget.GetComponentInChildren <Hero>(); Quaternion rotation = CalcRotation.CalculateRotation(currentTarget);; //determines the angle of rotation for the arrow DamagingFlyingObject ball = Instantiate(mageBall, positionForArrow, rotation, transform); //instantiates an arrow object ball.FireArrow(dealsDamage); //fires the arrow }