IEnumerator DisparoTrasero() { if (disparoDisponible2) { disparoDisponible2 = false; for (int i = 0; i < cantDisparosTraseros; i++) { GameObject bullet2 = (GameObject)Instantiate(bulletTrasera); bullet2 b2 = bullet2.GetComponent <bullet2>(); b2.direccion = direccionDisparoTrasero; bullet2.transform.position = bulletPosition2.transform.position; bullet2.tag = "PlayerBullet"; direccionDisparoTrasero = !direccionDisparoTrasero; yield return(new WaitForSeconds(tiempoEntreDTraseros)); } yield return(new WaitForSeconds(cadenciaDTrasero)); disparoDisponible2 = true; } }
void Shot2() { clone2 = Instantiate(bullet2, transform.position, Quaternion.identity); bullet2.forward = transform.forward; }