// Update is called once per frame void Update() { //プレイヤーが行動不可 or clear条件達成したならば停止する if (player.GetComponent <PlayerController>().GetTouchEnemy() == true || enemyGenerator.GetAttackEnemyCount() >= gameManager.GetClearScore()) { GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; return; } //プレイヤーに近づいたら走りだす Vector3 offset = player.transform.position - transform.position; float distance = offset.sqrMagnitude; //Debug.Log(distance);//数値確認用 if (distance < 2000f) { animator.SetTrigger("run"); source.PlayOneShot(sounds[1]); } }
// Update is called once per frame void Update() { text.text = "AttackEnemy : " + enemyGenerator.GetAttackEnemyCount(); }