//空中斬撃用 public IEnumerator Shoot_Jump_Slash_Cor(int num) { List <GameObject> bullet_List = new List <GameObject>(); Vector3 pos = transform.position + new Vector3(transform.parent.localScale.x * -24f, 0); //弾の生成 for (int i = 0; i < num; i++) { var bullet = ObjectPoolManager.Instance.Get_Pool(yellow_Rice_Bullet).GetObject(); bullet.transform.position = pos + new Vector3(0, -21f + i * 1.7f); bullet.transform.rotation = new Quaternion(0, 0, 0, 0); bullet_List.Add(bullet); yield return(new WaitForSeconds(0.16f / num)); } yield return(new WaitForSeconds(0.3f)); //回転と加速 float angle = 0, speed = 0; for (int i = 0; i < num; i++) { if (bullet_List[i].activeSelf == false) { continue; } angle = Random.Range(-180f, 180f); bullet_List[i].transform.Rotate(new Vector3(0, 0, angle)); speed = Random.Range(0.6f, 1.5f); bullet_List[i].GetComponent <Rigidbody2D>().velocity = bullet_List[i].transform.right * speed; } _accelerator.Accelerat_Bullet(bullet_List, 1.05f, 1.5f); UsualSoundManager.Instance.Play_Shoot_Sound(); nemuno_Controller.Play_Burst_Effect(); }
//鱗粉弾 public void Shoot_Scales_Bullet(int num, float speed) { List <GameObject> bullet_List = new List <GameObject>(); for (int i = 0; i < num; i++) { //弾生成 GameObject bullet = pool_Manager.Get_Pool(scales_Bullet).GetObject(); bullet.transform.position = transform.position + new Vector3(-16f * transform.parent.localScale.x, 12f); bullet_List.Add(bullet); //発射 float angle = 2 * Mathf.PI / num * i + Random.Range(0, 0.3f); var v = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle) + 0.5f) * speed * Random.Range(0.95f, 1.05f); bullet.GetComponent <Rigidbody2D>().velocity = v; bullet.GetComponent <Bullet>().Set_Inactive(5.0f); UsualSoundManager.Instance.Play_Shoot_Sound(); } _bullet_Acc.Accelerat_Bullet(bullet_List, 0.98f, 0.5f); }