敵の攻撃④(N-Way弾3・アルゴリズム改良)




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);
}
}
}




Danmaku Ⅱ(基礎2/全24回)
他のコースを見る



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);
}
}
}




敵の攻撃④(N-Way弾3・アルゴリズム改良)