Teachers open the door but You must enter by yourself.
using UnityEngine;
public class Taremaku : MonoBehaviour
{
public GameObject taremakuPrefab;
void Start(){
for (var i = 0; i < 340; i++){
Instantiate(
taremakuPrefab,
new Vector3(14f * (i / 170 * 2 - 1), 1.25f, 5.94f * (i % 170 + 1)),
Quaternion.Euler(0f, 90f, -90f),
transform
);
}
}
}
using UnityEngine;
public class Mato : MonoBehaviour
{
public GameObject matoPrefab;
void Start(){
for (var i = 0; i < 12; i++){
Instantiate(
matoPrefab,
new Vector3(-7f, 2.75f, 503f + 45f * i),
Quaternion.Euler(0f, 90f, 0f),
transform
);
}
}
}
var score=0;
void OnTriggerEnter(Collider other){
if(other.gameObject.tag == "Mato"){
score++;
Destroy(other.gameObject);
GetComponent<AudioSource>().Play();//的壊れる音
}
}