private void Func02() { if (frameCount % 4 == 0) { // 弾の生成 float col = 0.5f + 0.1f * Mathf.Sin(frameCount / 10.0f); for (int y = 0; y < 3; y++) { for (int x = 0; x < 6; x++) { bullet = Instantiate(this.bulletPrefab[0], this.transform.position, Quaternion.identity); bullet.SetAngle(6.28f / 6 * x + Mathf.Sin(frameCount / 16.0f) * 6.28f / 12, 6.28f / 16 * 5); bullet.SetSpeed(0.07f - 0.015f * y); bullet.accel.Set(0, -0.0003f, 0); bullet.SetColor(Color.HSVToRGB(col, 0.5f, 0.6f)); bulletList.Add(bullet); } } } int count = bulletList.Count; for (int i = count - 1; i >= 0; i--) { bulletList[i].velocity += bulletList[i].accel; bulletList[i].Move(); this.pos = bulletList[i].transform.position; if (this.pos.x < -10 || this.pos.x > 10 || this.pos.y < -10 || this.pos.y > 10 || this.pos.z < -10 || this.pos.z > 10) { Destroy(bulletList[i].gameObject); bulletList.Remove(bulletList[i]); } } }
private void Func01() { if (frameCount % 180 == 1) { // 弾の生成 float angle1 = Random.Range(0, 360); float angle2 = Random.Range(0, 360); float angle3 = Random.Range(0, 360); float col = Random.Range(0, 1.0f); for (int y = 0; y < 64; y++) { for (int x = 0; x < 32; x++) { bullet = Instantiate(this.bulletPrefab[0], this.transform.position, Quaternion.identity); bullet.SetAngle(6.28f / 64 * x, 6.28f / 64 * y); bullet.velocity = Quaternion.Euler(angle1, angle2, angle3) * bullet.velocity; bullet.SetColor(Color.HSVToRGB(col, 0.5f, 0.6f)); bulletList.Add(bullet); } } } int count = bulletList.Count; for (int i = count - 1; i >= 0; i--) { bulletList[i].Move(); this.pos = bulletList[i].transform.position; if (this.pos.x < -10 || this.pos.x > 10 || this.pos.y < -10 || this.pos.y > 10 || this.pos.z < -10 || this.pos.z > 10) { Destroy(bulletList[i].gameObject); bulletList.Remove(bulletList[i]); } } }