// Use this for initialization void Start() { power = target.GetComponent <DaPower>(); GetComponent <Renderer>().enabled = false; GetComponent <Collider>().enabled = false; up = target.GetComponentInParent <DaMove>(); active = false; }
// Update is called once per frame void Update() { bool isPaused = paused.GetComponent <GameStats>().paused; Vector3 screenPos = cam.WorldToScreenPoint(transform.position); if (!isPaused) { if (bala != null && (Input.GetMouseButtonDown(0) || Input.GetAxis("Disp") == 1)) { if (shoot == false) { actions.Aiming(); DaShootMove script = bala.GetComponent <DaShootMove>(); DaMove script2 = shotBy.GetComponent <DaMove>(); script.shotBy = shotBy; script.direction = !script2.direction; var rotation = Quaternion.identity; if (!script2.direction) { //Creamos una instancia del prefab en nuestra escena, concretamente en la posiciĆ³n de nuestro personaje rotation *= Quaternion.Euler(0, 180, 0); Instantiate(bala, new Vector3(transform.position.x + 0.05f, transform.position.y, transform.position.z), rotation); } else { //Creamos una instancia del prefab en nuestra escena, concretamente en la posiciĆ³n de nuestro personaje Instantiate(bala, new Vector3(transform.position.x - 0.05f, transform.position.y, transform.position.z), rotation); } shoot = true; audio.PlayOneShot(fire); } } if (Input.GetAxis("Disp") != 1) { shoot = false; } } }