// Use this for initialization void Start() { player = GameObject.FindWithTag("Player").gameObject; BGMBox.SetActive(false); mixer.SetFloat("BGM2Volume", 0); //UIたちの初期化 level = levelUI.GetComponent <Text> (); score = scoreUI.GetComponent <Text> (); resultScore = resultScoreUI.GetComponent <Text> (); highScore = highScoreUI.GetComponent <Text> (); resultUI.SetActive(false); Enums.Level = 0; Enums.Score = 0; //敵を生成 for (int i = 0; i < enemys.Length; i++) { enemys [i] = Instantiate(enemy) as GameObject; enemys [i].transform.parent = transform; enemys [i].SetActive(false); } //HP回復玉を生成 HPBall = Instantiate(healHP) as GameObject; HPBall.transform.parent = transform; HPBall.SetActive(false); StartCoroutine(isEnemy()); }
IEnumerator BGMChange() { float sound = 0; while (sound >= -80) { sound -= 1.6f; mixer.SetFloat("BGM2Volume", sound); yield return(new WaitForSeconds(0.03f)); } if (sound <= -80) { BGMBox.SetActive(true); } }