敵の攻撃④(N-Way弾3・アルゴリズム改良)
![6be799f5 40af 4058 934c 4a85865b1ebb](https://codegenius.org/uploads/slide/image/731/6be799f5-40af-4058-934c-4a85865b1ebb.jpeg)
![0ae33f73 b4c8 4471 a5a7 c718f84d32f3](https://codegenius.org/uploads/slide/image/732/0ae33f73-b4c8-4471-a5a7-c718f84d32f3.jpeg)
![777bd925 5ed3 46c5 83e1 dffaf03951c4](https://codegenius.org/uploads/slide/image/733/777bd925-5ed3-46c5-83e1-dffaf03951c4.jpeg)
![0f125d86 d082 4c73 a8f9 fcf43501fb42](https://codegenius.org/uploads/slide/image/734/0f125d86-d082-4c73-a8f9-fcf43501fb42.jpeg)
N-Way弾のアルゴリズム2(改良)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NWay : MonoBehaviour
{
public GameObject enemyFireMissilePrefab;
public int wayNumber;
void Start()
{
for (int i = 0; i < wayNumber; i++)
{
// ★改良
// 小数の場合「f」を必ずつけること。fを忘れるとエラーになります。(ポイント)
GameObject enemyFireMissile = Instantiate(enemyFireMissilePrefab, transform.position, Quaternion.Euler(0, 7.5f - (7.5f * wayNumber) + (15 * i), 0));
enemyFireMissile.transform.SetParent(this.gameObject.transform);
}
}
}
![De23d6b1 3156 44ce 9059 3db5b7e0187a](https://codegenius.org/uploads/slide/image/735/de23d6b1-3156-44ce-9059-3db5b7e0187a.jpeg)
![74b40390 27d2 4293 bb9a c5504fbe1b0d](https://codegenius.org/uploads/slide/image/736/74b40390-27d2-4293-bb9a-c5504fbe1b0d.jpeg)
![4e9eaa3e 4588 4c1e 99c9 2c4787d4fcac](https://codegenius.org/uploads/slide/image/737/4e9eaa3e-4588-4c1e-99c9-2c4787d4fcac.jpeg)
![1de31764 3ec4 43c0 87fa ce955b4000d0](https://codegenius.org/uploads/slide/image/738/1de31764-3ec4-43c0-87fa-ce955b4000d0.jpeg)
Danmaku Ⅱ(基礎2/全24回)
他のコースを見る![6be799f5 40af 4058 934c 4a85865b1ebb](https://codegenius.org/uploads/slide/image/731/6be799f5-40af-4058-934c-4a85865b1ebb.jpeg)
![0ae33f73 b4c8 4471 a5a7 c718f84d32f3](https://codegenius.org/uploads/slide/image/732/0ae33f73-b4c8-4471-a5a7-c718f84d32f3.jpeg)
![777bd925 5ed3 46c5 83e1 dffaf03951c4](https://codegenius.org/uploads/slide/image/733/777bd925-5ed3-46c5-83e1-dffaf03951c4.jpeg)
![0f125d86 d082 4c73 a8f9 fcf43501fb42](https://codegenius.org/uploads/slide/image/734/0f125d86-d082-4c73-a8f9-fcf43501fb42.jpeg)
N-Way弾のアルゴリズム2(改良)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NWay : MonoBehaviour
{
public GameObject enemyFireMissilePrefab;
public int wayNumber;
void Start()
{
for (int i = 0; i < wayNumber; i++)
{
// ★改良
// 小数の場合「f」を必ずつけること。fを忘れるとエラーになります。(ポイント)
GameObject enemyFireMissile = Instantiate(enemyFireMissilePrefab, transform.position, Quaternion.Euler(0, 7.5f - (7.5f * wayNumber) + (15 * i), 0));
enemyFireMissile.transform.SetParent(this.gameObject.transform);
}
}
}
![De23d6b1 3156 44ce 9059 3db5b7e0187a](https://codegenius.org/uploads/slide/image/735/de23d6b1-3156-44ce-9059-3db5b7e0187a.jpeg)
![74b40390 27d2 4293 bb9a c5504fbe1b0d](https://codegenius.org/uploads/slide/image/736/74b40390-27d2-4293-bb9a-c5504fbe1b0d.jpeg)
![4e9eaa3e 4588 4c1e 99c9 2c4787d4fcac](https://codegenius.org/uploads/slide/image/737/4e9eaa3e-4588-4c1e-99c9-2c4787d4fcac.jpeg)
![1de31764 3ec4 43c0 87fa ce955b4000d0](https://codegenius.org/uploads/slide/image/738/1de31764-3ec4-43c0-87fa-ce955b4000d0.jpeg)
敵の攻撃④(N-Way弾3・アルゴリズム改良)