void Update() { if (!controller.startGame) { return; } if (GameData.lost) { return; } float boundY = fireball.GetComponent <CircleCollider2D>().radius; if (Timer < Time.time) { GameObject enemy = GameObject.FindWithTag("Enemy"); Vector3 enemyPos = enemy.transform.position; enemyPos.y = Random.Range(minH + boundY, maxH - boundY); Quaternion rotation = enemy.transform.rotation; Vector3 spawnPos = enemyPos; Instantiate(fireball, spawnPos, rotation); AudioManager_Pell.PlaySFX(fireballSFX); Timer = Time.time + interval; } }
void Awake() { _instance = this; if (music) { ambienceSource.loop = true; ambienceSource.clip = music; ambienceSource.Play(); } }