-3
我試圖強制Unity每秒產生一個gameobject與協程,但我得到錯誤cs1502 & cs1503。 (抱歉,如果這是一個愚蠢語法錯誤)如何使用協程每秒產生一個遊戲對象。 (錯誤cs1502&cs1503)?
public class BossCannon : MonoBehaviour
{
public BossBullet BossAmmo;
public float Force;
public bool trigger = false;
void Start()
{
}
void Update()
{
if (trigger == true)
ShootBullet();
}
void ShotPattern()
{
while (true)
{
StartCoroutine(Shoot);
}
}
public IEnumerator Shoot()
{
trigger = false;
yield return new WaitForSeconds(1f); //Waits 1 second
GameObject b = Instantiate(BossAmmo.gameObject, transform.position, transform.rotation) as GameObject;
trigger = true;
}
}