敵の攻撃③(N-Way弾の改良)




NWay弾の改良
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);
}
}
}




【2019版】Danmaku Ⅱ(基礎2/全38回)
他のコースを見る



NWay弾の改良
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弾の改良)