Teachers open the door but You must enter by yourself.
using UnityEngine;
public class Taremaku : MonoBehaviour
{
public GameObject prefab;
void Awake(){
for (var i = 0; i < 340; i++){
Instantiate(
prefab,
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 prefab;
void Awake(){
for (var i = 0; i < 12; i++){
Instantiate(
prefab,
new Vector3(-7f, 2.75f, 503f + 45f * i),
Quaternion.Euler(0f, 90f, 0f),
transform
);
}
}
}
void OnTriggerEnter(Collider other){
var mato=other.gameObject;
if(mato.tag == "Mato"){
GetComponent<AudioSource>().Play();//的壊れる音
Destroy(mato);
}
}